# Re: HP Calculator Programming, Feet and Inch Decimal Conversion

• To: <seaint(--nospam--at)seaint.org>
• Subject: Re: HP Calculator Programming, Feet and Inch Decimal Conversion
• From: "John MacLean" <john_maclean(--nospam--at)pomeroy.bc.ca>
• Date: Wed, 10 Jan 2001 10:58:09 -0800
```Okay here's my little program for the HP32S:

Feet and inches are entered using four decimal places to the nearest 1/16th
of an inch e.g.:

5.0612

means 5 feet 6 and 12/16 (3/4) inches.

To convert this to decimal feet I use a program which takes each piece of
the number and converts it to decimal feet then adds them together. In order
to be able to add a succession of numbers together its important not to
disturb the "y" level in the stack. Here's a listing from my program:

A01 LBL A
A02 STO Z
A03 IP
A04 STO W
A05 CLx
A06 RCL Z
A07 FP
A08 100
A09 X
A10 STO X
A11 IP
A12 12
A13 /
A14 STO+ W
A15 CLx
A16 RCL X
A17 FP
A18 1.92
A19 /
A20 RCL+ W
A21 RTN

In the listing "/" should really be that line with the two dots to match HP
notation but I don't seem to have it on my keyboard anywhere.

The program ain't pretty but it seems to work reasonably well. It blows out
the  top (fourth) number in the stack but preserves the 2nd and 3rd. So I
can add up a string of feet and inch dimensions quite quickly. Once I'm
finished I have a similar program which converts back to inches and 1/16ths.
The program does use the W, X and Z storage registers which could be a
problem if you have anything stored there.

Beauty, eh?

Cheers,
John MacLean

```