program top
rem 	Uses the quadratic formula to solve for the real and complex roots of
rem 	a second degree polynomial. The user is prompted for a, b, and c
rem	of ax + bx +c. The real roots are displayed in the X register.
rem	The imaginary roots are displayed in the R and I registers.
lbl q
input a
x=0?
gto q
input b
input c
x=0?
gto q
rcl b
sign
cf 0
x<0?
sf 0
rcl b
x^2
4
rclx a
rclx c
-
x<0?
gto i
sqrt
fs? 0
sign
+
2
/
rcl/ a
sto x
view x
rcl c
rcl/ a
rcl/ x
sto x
view x
gto q
lbl i
abs
sqrt
2
rclx a
/
sto i
rcl b
sign
lastx
/
sto r
rcl i
rcl r
view r
view i
gto q
rtn
