Re: Short Quadratic Solver (HP42S) Message #6 Posted by Csaba Tizedes (Hungary) on 24 Oct 2010, 6:08 p.m., in response to message #5 by Gerson W. Barbosa
Maybe the HP's SOLVE algorithm is accurate?
Here is my solution (from my memories...)  not shortest, uses variables, but not uses the classical quadratic formula. The 32SII (lowend) version:
 The firs root:
I01 LBL I
I02 CF 0
I03 FN=Q
I04 SOLVE X
I05 GTO X
I06 SF 0
I07 RTN
7 steps / CK=368D / 10.5 byte
 The second:
X01 LBL X
X02 STOP
X03 RCL B
X04 RCL div A
X05 +
X06 +/
X07 RTN
7 steps / CK=0339 / 10.5 byte
 The quadratic equation:
Q01 LBL Q
Q02 RCL X
Q03 RCL mul A
Q04 RCL add B
Q05 RCL mul X
Q06 RCL add C
Q07 RTN
7 steps / CK=8AAE / 10.5 byte
'add', 'sub', 'mul' and 'div' means 'add', 'substact', 'multiple' and 'divide' in this order.
Solve for real roots of an 'a*x^2+b*x+c=0' equation:
a STO A, b STO B, c STO C then XEQ I.
If FLAG 0 set this equation has no real roots (location of extremum on display).
If FLAG 0 not set, the first real root appear on LCD, then press R/S, then the second root will be on the display.
Enjoy!
