HP-71B Enhanced Math LEX
|
01-27-2020, 12:42 PM
Post: #17
|
|||
|
|||
RE: HP-71B Enhanced Math LEX
(01-27-2020 11:35 AM)Albert Chan Wrote:(01-27-2020 08:05 AM)J-F Garnier Wrote: I understand that the alternate formula (x+y)*(x-y) saves a multiplication, but does it guarantee that the result will be *always* better? I tend to agree with you. (x+y)*(x-y) is better than (x*x-y*y) especially when x and y are close. For instance: >X=PI @ Y=PI-1E-11 >Z=(X,Y) >Z*Z (6.283E-11,19.7392088021) >(X+Y)*(X-Y) 6.28318530717E-11 The last formula gives 8 more significant digits for the real part. Note, however, than in this particular case, the involution formula gives an even worst result: >Z^(2,0) (6.27015817311E-11,19.7392088021) I checked the x^2 (or SQ in RPL) function on HP Saturn-based machines up to the 49G+ and they all seem to use the x*x-y*y formula. So I will refrain from implementing the (x+y)*(x-y) approach in the 71 Math 2 LEX, my goal is to align its performance with other machines of the time (75C, 28S, 42S), and the Z^2 case implemented as Z*Z already provides an interesting improvement. J-F |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)