## Q function of HP-21S unveiled

All other HP calculators

### Q function of HP-21S unveiled

With the trace feature of Emu42 I was able to find out the two procedures of the HP-21S to compute Q(z) -- one of them was new to me.
Here an HP-42S program using the same algorithms.
Code: Select all
`00 { 131-Byte Prgm }01▶LBL "Q(z)"02 X<0?03 AON04 ABS05 ENTER06 X^207 -208 ÷09 E^X10 PI11 STO+ ST X12 SQRT13 ÷14 STO 0215 X<>Y16 2,3217 X>Y?18 GTO 0219 Rv20 STO 0421 STO 0622 ÷23 STO 0524 CLX25 STO 0026 STO 0127 SIGN28 STO 0329▶LBL 0130 ISG 0031 CLD32 RCL 0133 RCL× 0034 RCL 0235 STO 0136 RCL× 0637 +38 STO 0239 RCL 0340 RCL× 0041 RCL 0442 STO 0343 RCL× 0644 +45 STO 0446 ÷47 ENTER48 X<> 0549 -50 RCL÷ ST L51 ABS52 -953 10^X54 X≤Y?55 GTO 0156 SIGN57 RCL 0558 FS? 4859 -60 GTO 0961▶LBL 0262 SIGN63 STO 0064 Rv65 ×66 STO 0167 LASTX68 X^269 STO 0270 X<>Y71▶LBL 0372 RCL 0173 RCL× 0274 275 RCL+ 0076 STO 0077 ÷78 STO 0179 RCL+ ST Y80 X≠Y?81 GTO 0382 283 1/X84 FC? 4885 +/-86 +87 ABS88▶LBL 0989 AOFF90 END`

Note: in contrast to the HP-32E the HP-21S calculates "the upper tail" of the Q function.

The formulas? If you are truly interested take a closer look to this user code routine, it is much simpler than analysing some firmware trace.

M.

Edit: replaced lines 13 1/x and 14 * by 13 / only. It was a holdover from the HP-21S, which uses the constant @03966: #0398942280401432.
mike-stgt
.........

Posts: 132
Joined: Tue Dec 24, 2019 12:12 pm