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.
Acknowledgements:
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 www.hpmuseum.com
have
been an important driver for developing this new version.
Usage:
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.
Examples:
Technical notes:
- The precision used is 10^-9 if in ALL-display mode or the actual
accuracy of the chosen display mode if in FIX/SCI/ENG-mode.
- QPI uses continued fraction expansion for the rational
approximation and then the same set of rules for choosing the form as
QPI v4.3 for the HP48. Generally it prioritises smaller denominators.
- The variables X_QPI, Y_QPI, Z_QPI, T_QPI, L_QPI,
R_QPI are used for storing stack and register contents and should
be considered reserved variables
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