Post Reply 
(32S) Some Algorithms for RPN Calculators
10-03-2022, 12:04 AM
Post: #1
(32S) Some Algorithms for RPN Calculators
Four programs ported to the HP 32SII calculator from algorithms designated for the 1973 HP 45 calculator.

HP 32SII: Euclid Algorithm - Greatest Common Divisor (GCD)

The HP 45 algorithm is found on page 228 in the Algorithms For RPN Calculators book. (see source below)

This algorithm takes up three labels.

Code:
E01 LBL E
E02 INPUT M
E03 ENTER
E04 ENTER
E05 ENTER
E06 INPUT N
E07 x<>y

K01 LBL 1
K02 ÷
K03 FP
K04 ×
K05 1
K06 x>y?
K07 GTO L
K08 R↓
K09 ENTER
K10 ENTER
K11 R↓
K12 R↓
K13 GTO K

L01 LBL L
L02 R↓
L03 R↓
L04 RTN

Sizes and Checksums:
E: 10.5 bytes, 9D4D
K: 19.5 bytes, F8AD
L: 6.0 bytes, C304
Total: 36.0 bytes

Instructions:
Press [ XEQ ] E, enter M and N.

Examples:

Input: M = 36, N = 28. Result: 4
Input: M = 48, N = 126. Result: 6
Input: M = 115, N = 300. Result: 5



HP 32SII: Tetens Equation

The HP 45 algorithm is found on page 290 in the Algorithms For RPN Calculators book. The original algorithm took the temperature in Celsius.

Find the saturation of water vapor (e_m) in mmHg (millimeters of Mercury) given the temperature in °F.

Determined Formulas:
T (in °C) = (T°F - 32) * 5/9
α = T/(236.87 + T)
e_m = 4.579 * 10^(7.49 * α)

Code:
T01 LBL T
T02 INPUT T
T03 →°C
T04 ENTER
T05 ENTER
T06 236.87
T07 +
T08 ÷
T09 7.49
T10 ×
T11 10^x
T12 4.579
T13 ×
T14 RTN
Size and Checksum:
45.0 bytes, 404A

Examples:
T = 68 °F, Result: 17.53658 mmHg
T = 99 °F, Result: 47.63501 mmHg


HP 32SII: Dew Point Given Relative Humidity and Air Temperature

The HP 45 algorithm is found on page 290 in the Algorithms For RPN Calculators book. The original algorithm took the temperature in Celsius.

Relativity humidity (F) is to be entered as a decimal. For instance, instead of 20%, enter 0.20.

Determined Formulas:
T (in °C) = (T°F - 32) * 5/9
A = T/(T + 236.87)
B = 1/(log F/7.49 + A)
TD = 236.87/(B - 1)
TD = TD * 9/5 + 32

Code:
D01 LBL D
D02 INPUT T
D03 →°C
D04 ENTER
D05 ENTER
D06 236.87
D07 STO A
D08 +
D09 ÷
D10 INPUT F
D11 LOG
D12 7.49
D13 ÷
D14 +
D15 1/x
D16 1
D17 -
D18 RCL÷ A
D19 1/x
D20 →°F
D21 RTN

Size and Checksum:
47.5 bytes, 8677

Examples:
T = 80, F = 0.64, Result: 66.725
T = 95, F = 0.32, Result: 60.50684


HP 32SII: Effective Temperature Due to Wind Velocity


The HP 45 algorithm is found on page 291 in the Algorithms For RPN Calculators book. The original algorithm took the temperature in Fahrenheit.

Wind velocity is in miles per hour (mph).

Determined Formulas:
A = 0.634*(0.634 - log V)
ΔT = A*(T - 90)
Effective T = T - ΔT

Code:
E01 LBL E
E02 0.634
E03 ENTER
E04 ENTER
E05 INPUT V
E06 LOG
E07 -
E08 ×
E09 INPUT T
E10 ENTER
E11 90
E12 -
E13 ×
E14 RCL T
E15 x<>y
E16 -
E17 RTN

Size and Checksum:
33.5 bytes, 54F7

Examples:
V = 20 mph, T = 15 °F, Result: -16.71728
V = 15 mph, T = 86 °F, Result: 84.62526

Source:

Ball, John A. Algorithms For RPN Calculators John Wiley & Sons: New York, NY. 1978. ISBN 0-471-03070-8
Visit this user's website Find all posts by this user
Quote this message in a reply
10-03-2022, 07:46 AM (This post was last modified: 10-03-2022 08:17 AM by Steve Simpkin.)
Post: #2
RE: (32S) Some Algorithms for RPN Calculators
Very cool Eddie.
By the way, Algorithms For RPN Calculators by John Ball is available to view (borrow) online at the Internet Archive.
https://archive.org/details/algorithmsforrpn0000ball

You will need to create a free account to see it. Here is the Table of Contents for reference.
[attachment=11194]

P.S. I love the handful of the HP-25 program examples in this book!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)