(SQRT 0 1i ) ^2

General discussion about calculators, SwissMicros or otherwise
User avatar
Brianetta
Posts: 23
Joined: Sat Apr 23, 2022 10:00 pm
Location: United Kingdom

Re: (SQRT 0 1i ) ^2

Post by Brianetta »

J-F Garnier wrote:
Wed Jun 22, 2022 2:15 pm
No bug here
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.
🖩 DM16L, DM42
User avatar
rudi
Posts: 415
Joined: Wed Nov 03, 2021 9:03 am
Location: Denmark
Contact:

Re: (SQRT 0 1i ) ^2

Post by rudi »

J-F Garnier wrote:
Wed Jun 22, 2022 2:15 pm
rudi wrote:
Wed Jun 22, 2022 10:10 am
My 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
-
A simple counter-example:
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
Yup - no bug, just roundings. That's what I was trying to tell ;)
/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
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: (SQRT 0 1i ) ^2

Post by Thomas Okken »

Brianetta wrote:
Wed Jun 22, 2022 2:52 pm
J-F Garnier wrote:
Wed Jun 22, 2022 2:15 pm
No bug here
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.
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...
User avatar
Brianetta
Posts: 23
Joined: Sat Apr 23, 2022 10:00 pm
Location: United Kingdom

Re: (SQRT 0 1i ) ^2

Post by Brianetta »

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
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: (SQRT 0 1i ) ^2

Post by Thomas Okken »

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.
User avatar
Brianetta
Posts: 23
Joined: Sat Apr 23, 2022 10:00 pm
Location: United Kingdom

Re: (SQRT 0 1i ) ^2

Post by Brianetta »

That's true, of course, but I don't work in the field of applied mathematics. I bought a calculator.
🖩 DM16L, DM42
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: (SQRT 0 1i ) ^2

Post by Walter »

Brianetta wrote:
Thu Jun 23, 2022 10:48 am
That's true, of course, but I don't work in the field of applied mathematics. I bought a calculator.
So true. :lol: 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:
J-F Garnier wrote:
Tue Jun 21, 2022 9:25 am
Here 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
Dealing with the same problem on the WP43S:
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
User avatar
Brianetta
Posts: 23
Joined: Sat Apr 23, 2022 10:00 pm
Location: United Kingdom

Re: (SQRT 0 1i ) ^2

Post by Brianetta »

Walter wrote:
Thu Jun 23, 2022 11:17 am
Your only error, fault, ... whatsoever: You bought a calculator and complained.
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
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: (SQRT 0 1i ) ^2

Post by Thomas Okken »

Brianetta wrote:
Thu Jun 23, 2022 12:15 pm
Calling something a bug is not a complaint in my understanding.
I admire your linguistic creativity, but I don't think it helps in achieving communication. :lol:
User avatar
rudi
Posts: 415
Joined: Wed Nov 03, 2021 9:03 am
Location: Denmark
Contact:

Re: (SQRT 0 1i ) ^2

Post by rudi »

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
/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
Post Reply