HP-71B Enhanced Math LEX
01-27-2020, 08:05 AM
Post: #15
 J-F Garnier Senior Member Posts: 907 Joined: Dec 2013
RE: HP-71B Enhanced Math LEX
(01-26-2020 03:08 PM)Albert Chan Wrote:  It take a while to find a counter-example.
>X=.254661579433 @ Y=.260740997689
>COMPLEX Z @ Z = (X,Y)
>Z^2
(-3.13334783654, .132801428589)
>Z*Z
(-3.13334783655, .132801428589)

Nice finding of a worst case for z*z, thanks! I believe that the z^2 result is better just by chance.
How did you find it? I'm guessing just brute force?
Anyway, the next 3 digits are 493, very close to the limit for up/down rounding, so we may say that both answers are equally right :-)

Quote:Real part of Z = X*X - Y*Y = (X+Y) * (X-Y) gives better result.
> (X+Y) * (X-Y) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ! exact value = -3.13334783654 4934739232
-3.13334783654

Interesting. The 71 is using the x*x-y*y formula, as do the following Saturn-based machines since they give the same answer for your worst case test.
I understand that the alternate formula (x+y)*(x-y) saves a multiplication, but does it guarantee that the result will be *always* better?