I'm pretty sure this counts as a bug, just one that is far too expensive to fix. We've instead learned to accept it.
(SQRT 0 1i ) ^2
Re: (SQRT 0 1i ) ^2
🖩 DM16L, DM42
Re: (SQRT 0 1i ) ^2
Yup - no bug, just roundings. That's what I was trying to tellJ-F Garnier wrote: ↑Wed Jun 22, 2022 2:15 pmA simple counter-example:rudi wrote: ↑Wed Jun 22, 2022 10:10 amMy DM42 handles SQRT of an large integer rather fine, no rounding errors in the below, which results in zero.
Try pressing SHOW after entering the 34 digit integer, all digits are there, even though the DM42 displays 1,23456789012E33 in ALL mode.Code: Select all
1234567890123456789012345678901234 ENTER SQRT X^2 -
3E32 SQRT X^2 -> 299999999999999999999999999999999.9
No bug here, it's just due to the finite representation of SQRT(3E32) with 34 digits.
This is machine-dependent, the usual well-known example on HP Saturn machines is SQRT(2) instead of SQRT(3).
J-F
/Rudi
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: (SQRT 0 1i ) ^2
If you count finite precision as a bug, building bug-free calculators is impossible. That doesn't seem like a very useful definition, but to each their own...
Re: (SQRT 0 1i ) ^2
I do, but I also accept that some bugs can't be easily fixed and must be worked around instead. It's worth understanding them. For the expression X, dup, sqrt, sq, minus; X=0? is "Yes" for 1, 2, 4, 6, 8 and "No" for 3, 5, 7. That's unexpected, and affects program control. Pretty sure the HP50g gets around this by being all symbolic instead of working to any precision.
🖩 DM16L, DM42
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: (SQRT 0 1i ) ^2
I hate to say it, but if you think that's unexpected, that indicates a lack of experience on your part. It is well-known in applied mathematics that you should avoid comparing floating-point numbers for equality. Again, that's an inevitable consequence of finite precision.
Re: (SQRT 0 1i ) ^2
That's true, of course, but I don't work in the field of applied mathematics. I bought a calculator.
🖩 DM16L, DM42
Re: (SQRT 0 1i ) ^2
So true. Your only error, fault, ... whatsoever: You bought a calculator and complained. This will be punished with two applied math lessons minimum.
And 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).
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
I would like to appeal this sentencing on the grounds that I did not complain. Calling something a bug is not a complaint in my understanding. Like I said, some bugs we accept and work around, but we do need to be aware of them.
🖩 DM16L, DM42
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: (SQRT 0 1i ) ^2
Brianetta, 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
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
/Rudi
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark