The Museum of HP Calculators


Date calculations and TVM calculations for the HP-32Sii

This program is by Andy Schick and is used here by permission.

This program is supplied without representation or warranty of any kind. Andy Schick and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

Here is a program designed specifically for the hp-32sii calculator. This program converts a Date to/from a Julian Day Number, calculates days between two dates, determines the day of the week, gives you the MOD function, and determines your Physical-Intellectual-Emotional Biorhythm.

Also included here is a second reduced size version of the program so date calculations can still be performed and leave room in the calculator’s 384 bytes of memory to also be able to run the Time Value of Money (TVM) equation for the HP Solver. With the reduced code, you loose the ability to convert a Julian Day Number back to a Date, but you can still calculate the days between two dates, determine the day of week, have the MOD function, and still calculate your Intellectual Biorhythm.

The date calculations use the formulas published by HP for the hp-67 in 1976. The program is original code written by Andy Schick.

The TVM equation is below and can be entered as an equation to be solved with the HP Solver. No further TVM or HP Solver instructions are provided here.

P*100*(1-(1+I/100)-N)/I+F*(1+I/100)-N+B

To save memory, this date program uses the same variables as in the TVM equation.

The specific functions are as follows:

XEQ C ­ Just a function to initialize Julian numbers.
XEQ N ­ Convert a Date in the format of mm.ddyyyy to a Julian Day Number.
XEQ A, E, F, G, H, I ­ Just secondary labels with no useful purpose to the user.
XEQ D ­ Convert a Julian Day number to a Date in the format mm.ddyyyy.
XEQ M ­ Modulo (MOD) function.
XEQ W ­ Calculate the Day of Week from Julian Day Number. (S=0, M=1, T=2, W=3, Th=4, F=5, Sa=6).
XEQ B ­ From days old, determine Physical, Intellectual, and Emotional Biorhythm numbers.

Example Usage:

Example 1. Using the Modulo (MOD) function. 14 MOD 5 = 4.

14
ENTER
5
XEQ M      X stack register now displays the answer 4.
Example 2. Calculating the number of days old a person is. If today is Dec 27 2006, and a person was born on Feb 13 1962.
12.272006
XEQ N      X stack register now displays 2,454,097.
2.131962
XEQ N      X stack register now displays 2,437,709.
-          X stack register now displays 16388,
           the age of the person in days.

Example 3. Calculation of Biorhythm numbers.

With 16388 still in the X stack register:

XEQ B
           Now displayed is P= -14.  This is the persons 
           Physical Biorhythm number. The range is from
           a low of ­100 to a high of +100.
R/S
           Now displayed is I= -62.  This is the persons
           Intellectual Biorhythm number.
R/S
           Now displayed is E= 97.  This is the persons
           Emotional Biorhythm number.
R/S
           The display returns to FIX 4 mode.

Example 4. To calculate what date is 1000 days after May 24 1985.

5.241985
XEQ N      X stack register now displays 2,446,210.
1000
+
XEQ D      X stack register now displays the calculated
           date 2.181988.

Example 5. What day of week was Dec 31 1999?

12.311999
XEQ N
XEQ W      X stack register now displays 5.
           (S=0, M=1, T=2, W=3, Th=4, F=5, Sa=6).  
           It was a Friday.
To have full Date to/from Julian Day Number calculation capability and no TVM capability enter the code listed below.

Program checksum and size info. Total program size is 288.0 Bytes.

C        CK= 1955        36.0
N        CK= F723        43.5
A        CK= 8660         4.5
F        CK= 7AB9        27.0
D        CK= CBD8        63.0
E        CK= 21EF         4.5
G        CK= 3F39        10.5
H        CK= C554        19.5
M        CK= 2330        19.5
W        CK= F42C         9.0
I        CK= 5B29        24.0
B        CK= 9DA6        27.0
Program variables: B, D, E, F, I, N, P.

Listing

LBL C
365.25
STO B
30.6001
STO D
1,720,982
STO E
RTN
LBL N
X⇔Y
STO N
R↓
ENTER
IP
STO I
R↓
FP
100
×
ENTER
IP
STO F
R↓
FP
4
1OX
×
STO P
RCL I
2
X<Y?
GTO A
13
STO+ I
1
STO- P
GTO F
LBL A
1
STO+ I
LBL F
XEQ C
RCL P
RCL B
×
IP
RCL I
RCL D
×
IP
+
RCL F
+
RCL E
+
RCL N
X⇔Y
RTN
LBL D
RCL E
-
STO F
122
-
10
1/X
-
RCL B
÷
IP
STO P
RCL B
×
IP
+/-
RCL F
+
RCL D
÷
IP
STO I
RCL D
×
IP
RCL P
RCL B
×
IP
+
+/-
RCL F
+
STO F
14
RCL I
X<Y?
GTO E
13
STO- I
GTO G
LBL E
1
STO- I
LBL G
RCL I
2
X<Y?
GTO H
1
STO+ P
LBL H
RCL P
6
10X
÷
RCL F
100
÷
+
RCL I
+
FIX 6
RTN
LBL M
STO I
X⇔Y
STO P
X⇔Y
÷
IP
RCL I
×
RCL P
X⇔Y
-
RTN
LBL W
1
+
7
XEQ M
RTN
LBL I
STO I
RCL B
X⇔Y
XEQ M
RCL I
÷
180
×
2
×
SIN
100
×
RND
RTN
LBL B
DEG
FIX 0
STO B
23
XEQ I
STO P
VIEW P
33
XEQ I
STO I
VIEW I
28
XEQ I
STO E
VIEW E
FIX 4
RTN

To have date calculation capability, without Julian Day Number to Date capability, and still have memory space to run the TVM equation, enter only the code listed below.

Program checksum and size info.  
Total program size is 147.0 Bytes.
N        CK= F723        43.5
A        CK= 8660         4.5
F        CK= CB54        49.5
M        CK= 2330        19.5
W        CK= F42C         9.0
I        CK= 8F99        21.0

Program variables: F, I, N, P.
With this reduced version there is no longer functions D or B, but there is new function I. XEQ I ­ From days old, determine Intellectual Biorhythm number.

LBL N
X⇔Y
STO N
R↓
ENTER
IP
STO I
R↓
FP
100
×
ENTER
IP
STO F
R↓
FP
4
1OX
×
STO P
RCL I
2
X<Y?
GTO A
13
STO+ I
1
STO- P
GTO F
LBL A
1
STO+ I
LBL F
RCL P
365.25
×
IP
RCL I
30.6001
×
IP
+
RCL F
+
1,720,982
+
RCL N
X⇔Y
RTN
LBL M
STO I
X⇔Y
STO P
X⇔Y
÷
IP
RCL I
×
RCL P
X⇔Y
-
RTN
LBL W
1
+
7
XEQ M
RTN
LBL I
DEG
33
XEQ M
33
÷
180
×
2
×
SIN
100
×
RTN

Go back to the software library
Go back to the main exhibit hall