Yes. I understand the principle entirely. It's something we accept and work around.rudi wrote: ↑Thu Jun 23, 2022 12:27 pmBrianetta, let's play a game; You are a computer, that can calculate with 1 digit and four decimal places.
First you get the job to calculate 1 / 3:
That results in 0,3333
Now you get the job to calculate 3 * 0,3333:
That results in 0,9999
No errors occoured, but due to rounding and limited precission, you found that (1/3)*3 is not 1 but 0,9999
(SQRT 0 1i ) ^2
Re: (SQRT 0 1i ) ^2
🖩 DM16L, DM42
Re: (SQRT 0 1i ) ^2
It's worse: it's something we have to accept. And we can't work around it - we can take it into account only.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Re: (SQRT 0 1i ) ^2
What would be nice, though, is some indication whether a number displayed on screen has been rounded, as can be seen by using the SHOW function. When one divides 1 by three, then multiplies the result by three, the display looks like an integer value. The RND function works in all display modes except All, where it doesn't round to the displayed value (or do anything, as far as I can tell).
One of the things I liked about my school calculator, the TI-68, was that it worked to 13 places internally, and rounded to 10 places when it was done. If you want to maintain 13 places over several operations, it had an option (and an annunciator) for that. This sort of automatic rounding was neat.
One of the things I liked about my school calculator, the TI-68, was that it worked to 13 places internally, and rounded to 10 places when it was done. If you want to maintain 13 places over several operations, it had an option (and an annunciator) for that. This sort of automatic rounding was neat.
🖩 DM16L, DM42
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: (SQRT 0 1i ) ^2
Rounded to 10 places "when it was done"?
If you round to 10 places after every operation, you'll get 1 / 3 = 0.3333333333, then after multiplying that by 3 you get 0.9999999999, which is still not 1. The kind of magic you seem to be looking for would require the calculator to know that it shouldn't round after the first operation, but it should round after the second, because only then is the entire calculation "done." How is the calculator supposed to know?
(Regarding RND in ALL mode: it rounds to 12 digits since version 3.0.11.)
If you round to 10 places after every operation, you'll get 1 / 3 = 0.3333333333, then after multiplying that by 3 you get 0.9999999999, which is still not 1. The kind of magic you seem to be looking for would require the calculator to know that it shouldn't round after the first operation, but it should round after the second, because only then is the entire calculation "done." How is the calculator supposed to know?
(Regarding RND in ALL mode: it rounds to 12 digits since version 3.0.11.)
Re: (SQRT 0 1i ) ^2
I thought you handled the pure imaginary ones already, Thomas - but only for Y/2 being a perfect square, I think.Thomas Okken wrote: ↑Wed Jun 22, 2022 9:07 amIndeed! Complex sqrt is missing special cases for pure real and pure imaginary arguments. That's an oversight.J-F Garnier wrote: ↑Tue Jun 21, 2022 9:25 amNice finding ! This is a minor Free42 accuracy flaw:
Doing SQRT( 0+1i ) is giving:
0.7071067811865475244008443621048490 +
0.7071067811865475244008443621048491 i
Since the real and imag parts are not equal (as they should be), squaring back this number doesn't give exactly 0 for the real part.
Werner
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L
Re: (SQRT 0 1i ) ^2
It wasn't an RPN calculator, you entered an algebraic expression onto the display that was executed all at once. I doubt it could be done sanely on a stack calculator. My 42 has a precision variable on it and a rounding program that I wrote that rounds to the number of figures in that variable. I use that before comparing any number to zero in a program.Thomas Okken wrote: ↑Thu Jun 23, 2022 1:53 pmRounded to 10 places "when it was done"?
If you round to 10 places after every operation, you'll get 1 / 3 = 0.3333333333, then after multiplying that by 3 you get 0.9999999999, which is still not 1. The kind of magic you seem to be looking for would require the calculator to know that it shouldn't round after the first operation, but it should round after the second, because only then is the entire calculation "done." How is the calculator supposed to know?
(Regarding RND in ALL mode: it rounds to 12 digits since version 3.0.11.)
That RND change is really encouraging. I just have to wait for it to be ported to the DM42.
🖩 DM16L, DM42
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
-
- Posts: 47
- Joined: Sun Mar 11, 2018 5:37 pm
- Location: France
Re: (SQRT 0 1i ) ^2
And for Free42:Walter wrote: ↑Thu Jun 23, 2022 11:17 amAnd while we're at it:Dealing with the same problem on the WP43S:J-F Garnier wrote: ↑Tue Jun 21, 2022 9:25 amHere is an example of a similar accuracy flaw on the HP-42S:
SQRT (0 + 0.4652 i) gives:
0.482286222071 +
0.482286222072 i
and squaring it back gives: -9.65E-13 + 0.4652 i
SQRT returns
0.482286222071499778398073106978605 +
0.482286222071499778398073106978605 × i.
Squaring it back gives 0. + i × 0.4652 (actually 0. + i × 0.4652000000000000000000000000000001).
SQRT returns
0.4822862220714997783980731069786050 +
0.4822862220714997783980731069786049 i
Squaring it back gives 1.e-34 + 0,4652i (exact imag part but small real part residual).
Well, both almost as good, but we may ask ourself: what is the best answer?
I tend to see Free42's answer slightly better since the absolute value |z| of the squared back result is closer to (actually exactly, rounded to 34 digits) 0.4652.
But this is true but for that example, there may be cases where Free42 gives inferior answers relative to the WP34S.
BTW, this example was aimed to illustrate the same flaw on the HP-42S, the cause for this machine was that the real and imag part values are very close to the fence between rounding up or down to 12 places: 0.482286222071(4998)
So the 12-digits numbers 0.482286222071 and 0.482286222072 are (almost) equally good.
Oh, a side question: I thought that the WP34S was based on the same Intel BCD library as Free42, is that correct?
J-F
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: (SQRT 0 1i ) ^2
No, the WP34S uses the IBM decNumber library.
- Over_score
- Posts: 160
- Joined: Fri May 05, 2017 9:37 pm
- Location: France
Re: (SQRT 0 1i ) ^2
I tend to say the WP43S result is the better one because it's the correctly rounded result.J-F Garnier wrote: ↑Thu Jun 23, 2022 5:39 pmWell, both almost as good, but we may ask ourself: what is the best answer?
I tend to see Free42's answer slightly better since the absolute value |z| of the squared back result is closer to (actually exactly, rounded to 34 digits) 0.4652.
0.4822862220714997783980731069786049561748... + i×0.4822862220714997783980731069786049561748... is the correct result according to WolframAlpha.
So the correctly rounded result to 34 digits is:
0.4822862220714997783980731069786050 + i×0.4822862220714997783980731069786050
DM42 SN00284 & SN03835 running C47, HP34C, HP41CV, HP42S, HP35s, WP34S, HP Prime