Re: x root y on hp42s Message #3 Posted by Gerson W. Barbosa on 7 Apr 2012, 11:51 p.m., in response to message #1 by David Griffith
The following results match what I get with ^{x}/y on the HP32 SII, except for the error messages. This can be optimized for size, of course.
00 { 41Byte Prgm }
01>LBL "XROOT"
02 STO ST Z
03 X<>Y
04 X>=0?
05 GTO 00
06 X<>Y
07 2
08 MOD
09 X=0?
10 DOT
11 Rv
12 X<>Y
13 ENTER
14 FP
15 X!=0?
16 DOT
17 Rv
18 Rv
19>LBL 00
20 SIGN
21 LASTX
22 RCL ST Z
23 1/X
24 Y^X
25 ABS
26 ×
27 .END.
Keystrokes Display
27 +/ ENTER 3 XEQ XROOT 3
32 +/ ENTER 5 XEQ XROOT 2
27 +/ ENTER 3 +/ XEQ XROOT 3.33333333333E1
32 +/ ENTER 5 +/ XEQ XROOT 4.99999999999E1
32 ENTER 5 +/ XEQ XROOT 0.5
625 ENTER 4 XEQ XROOT 5
625 ENTER 4 +/ XEQ XROOT 0.2
625 +/ 4 XEQ XROOT Invalid Type
27.5 ENTER 3.5 +/ XEQ XROOT 3.87937790083E1
27.5 +/ ENTER 3.5 XEQ XROOT Invalid Type
27.5 +/ ENTER 3.5 +/ XEQ XROOT Invalid Type
27.5 ENTER 3.5 XEQ XROOT 2.577732888
5 ENTER 0 XEQ XROOT Divide by 0
P.S.: Real arguments only.
Edited: 8 Apr 2012, 12:00 a.m.
