The Museum of HP Calculators


Quadratic Equation for the 42S

This program is Copyright © 2002 by Pascal Fellerich and is used here by permission. This program is based on the Quadratic Equation program in the 41C library.

This program is supplied without representation or warranty of any kind. Pascal Fellerich 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 works with complex numbers and roots as well. To solve the equation ax^2+bx+c=0, type <a> ENTER <b> ENTER <c> XEQ QUAD. The two roots are returned on the stack in x and y.

Program

00 { 29-Byte Prgm }
01 LBL "QUAD"
02 RCL ST Z
03 +/-
04 STO: ST Z
05 :
06 X<>Y
07 2
08 :
09 STO ST Z
10 STO ST T
11 X^2
12 +
13 SQRT
14 STO- ST Z
15 +
16 RTN

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