Re: What is this HP-41 program doing? Message #3 Posted by HrastProgrammer on 26 July 2002, 6:33 a.m., in response to message #2 by Ex-PPC member
Bravo! I used it in the school, some 17 years ago. In fact, I have used the following program which can handle complex solutions as well:
LBL A
CF 00 RCL Z ST+ T * 4 *
RCL Y CHS STO Z X^2 X<>Y -
X<0? SF 00 FS? 00 CHS SQRT
FS? 00 GTO 01
STO T X<>Y + LASTX R^ -
LBL 01 RCL Z ST/ Z /
END
Real solutions: flag 0 cleared, X=x1, Y=x2
Complex solutions: flag 0 set, X=Im, Y=Re
The size of this program is 41 bytes (not counting LBL A and END). I am aware this is not optimal and would like to make a proposal: Who can write a shorter program? Only stack registers and flag 00 can be used. Alpha register and data registers cannot be used. Synthetic instructions are welcome but alpha register should not be disturbed.
|