|Re: HP41 Feet and Inch Program|
Message #4 Posted by Fred Lusk (CA) on 12 Oct 2000, 9:12 p.m.,
in response to message #3 by Ty Rogers
I wrote a program (FEET) at least 15 years ago that sets up a two register RPN stack to handle feet-inch-fraction (f-i-f) calcuations. I have never posted it anywhere, because, well, I'm LAZY. But, e-mail me directly and I will put it together for you. I may even get it in shape to post. Even though I use a 42S day-to-day, I still use my 41CX for the FEET program (there's an error in my 42S version that I STILL haven't had time to track down...I tried to improve it and did something wrong).
The program will handle addition and subtraction of two f-i-f numbers (as long as the subtraction won't result in a negative number), multiplication and division of an f-i-f number by a contstant (e.g. diameter in f-i-f * pi to get circumference in f-i-f), f-i-f to decimal and decimal to f-i-f conversions. The program also provides one storage register.
One interesting feature of the program is that you are not limited to 16ths of an inch, though that is the default. The program can work with ANY fraction you choose...not just the binary ones like 1/2, 1/4, 1/8, etc., but also 1/10, 1/21, 1/123, etc. Also, if you give it a fraction of 0 or 1, you can work in feet and inches and not have to bother with fractions. If you are working in 8ths of an inch and enter a number in 20ths of an inch, the program will round off the "offending" entry to the nearest 8th of an inch. You can also enter 1'15-25/8" and the program will correct your entry to 2'6-1/8".
The program uses the X<>F, XTOA, and REGMOVE commands from the 41-CX, but there are workarounds. The heart of the program, the part that reduces the fractions, is based on the fraction reduction routine in the PPC ROM. You don't need the PPC ROM, however.
BTW, the program takes 438 bytes of program space and requires something like 12 data registers.