Back to index

QPI for the HP-42S, version 1.17

Dedicated to my beloved Sara and our coming child!  (Note: Albin was born on the 21st of January 2004)

By Erik Ehrling (Sweden). Any comments or suggestions are very welcome!

This is a version of QPI for the HP42S. It finds rational approximations to decimal numbers on the forms nom/den, sqrt(nom/den), nom/den*pi, ln(nom/den), e^(nom/den) - choosing among them the form that seems most suitable.


Many thanks to the authors of the HP48 version of QPI - Mika Heiskanen and André Schoorl. Their ruleset for determining the most suitable approximation have been brought over to the HP42S version without any modification. I would also like to express my greatest thanks to Christoph Giesselink for Emu42 and Hrastprogrammer for HP42X. Without these two HP42S emulators, writing QPI would have taken much more time. And last, but not least, all positive comments and requests for additions (e.g. for complex numbers) coming from HP42S users at have been an important driver for developing this new version.


Using QPI is simple, just enter a decimal number in the range -9.99999999E9 .. 9.99999999E9 and run QPI. The rational approximation takes anything from a few seconds for a simple fraction up to 30 seconds (for a complex number where all forms are tried before the best approximation can be chosen). When the approximation process is finished the result will be displayed in the upper area of the display and can also be found in the alpha register.

Note that the stack, all numbered registers and user flags are left unaltered by the program. It is therefore possible to run QPI in the middle of a calculation and then continue after it has run.


Technical notes: Binary files for emulators:
Raw binary: qpi.raw  Binary for HP-42X: qpi.42x

Revision History:
1.01 - Decreased max size for LN from LN(1E10) to LN(1E3)
1.02 - Changed functionality for handling -ln(nom/den) to be more in line with HP48 version.
(1.03 - 1.14 Unreleased test versions)
1.15 - Support for complex numbers. Factorisation of square roots (e.g. sqrt(8) -> 2 * sqrt(2)). Changed notation to be more in line with QPI for HP48. Slight speed-up.
1.16 - Change to lines 115-117 to correct sign error for -exp(x) where x<0.
1.17 - Updated program wrapper, now works also if REGS is complex

Generated by 42s2html - 28 February  2004, 20:24