05-24-2020, 09:54 PM
Probably someone has done it before, but...
Inspired by a HP41C program I found for the quadratic formula that uses only the 4 level stack, no INPUTs, no extra registers, I thought maybe I could do something similar with the HP35s, despite that it doesn't have the register arithmetic with the stack registers. The program uses the equivalent formula -(b/2a)±SQRT((b/2a)^2-(c/a)). The fact there is only 2 terms makes it easier. I don't think it could be done with the (-b±SQRT(b^2-4ac))/2a formula. We press a ENTER b ENTER c XEQ Q and the 2 solutions, real or complex returned in X and Y registers. No INPUTs, no extra registers, just the stack, in just 29 steps.
Inspired by a HP41C program I found for the quadratic formula that uses only the 4 level stack, no INPUTs, no extra registers, I thought maybe I could do something similar with the HP35s, despite that it doesn't have the register arithmetic with the stack registers. The program uses the equivalent formula -(b/2a)±SQRT((b/2a)^2-(c/a)). The fact there is only 2 terms makes it easier. I don't think it could be done with the (-b±SQRT(b^2-4ac))/2a formula. We press a ENTER b ENTER c XEQ Q and the 2 solutions, real or complex returned in X and Y registers. No INPUTs, no extra registers, just the stack, in just 29 steps.
Code:
Q001 LBL Q
Q002 EQN REGZ
Q003 /
Q004 RDN
Q005 X<>Y
Q006 /
Q007 2
Q008 /
Q009 +/-
Q010 ENTER
Q011 X^2
Q012 RUP
Q013 -
Q014 X>=0?
Q015 GTO Q021
Q016 +/-
Q017 SQRT
Q018 i
Q019 *
Q020 GTO Q022
Q021 SQRT
Q022 ENTER
Q023 ENTER
Q024 EQN REGT
Q025 +
Q026 RDN
Q027 -
Q028 RUP
Q029 RTN