The Museum of HP Calculators


Quadratic Roots for the HP 35s

This program is by Mark Schmidt and is used here by permission.

This program is supplied without representation or warranty of any kind. Mark Schmidt and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

This program prompts for the values A, B and C when you have an equation in the form of AX2 + BX + C = 0 and it returns the values of X that satisfy the equation in the X and Y registers and variables. Imaginary numbers will be returned when appropriate. It is written for RPN mode.

Listing

Q001 LBL Q
Q002 INPUT A
Q003 INPUT B
Q004 INPUT C
Q005 RCLx A     ← Recall times A
Q006 -4         ← Negative 4 
Q007 ×          ← times
Q008 RCL B
Q009 x2         ← X squared key
Q010 +
Q011 x≥0?       ← X greater than or equal to 0 command
Q012 GTO Q018
Q013 +/-        ← Handle imaginary roots
Q014 √x
Q015 i          ← Square root of -1 
Q016 ×          ← times
Q017 GTO Q019
Q018 √x
Q019 STO D
Q020 RCL- B     ← Recall minus B
Q021 2
Q022 ÷
Q023 RCL÷ A     ← Recall divide by A
Q024 STO Y      ← Saving first root
Q025 RCL D
Q026 +/-
Q027 RCL- B     ← Recall minus B
Q028 2
Q029 ÷
Q030 RCL÷ A     ← Recall divide by A
Q031 STO X      ← Saving second root
Q032 RTN

Go back to the software library
Go back to the main exhibit hall