MCODE multiprecision library for HP41 Message #1 Posted by PeterP on 6 Nov 2008, 11:37 a.m.
MCODE MultiPrecision Library for HP41
A little while ago I decided to learn a bit of MCODE programming and hence I was looking for a project. Guided by the helpful hints from Valentin during his SSMC #4 and SSMC #20  scroll down to very last post I started to build a MCODE based multiprecision library for the HP41.
Many hours later and thanks to the help of many here on the forum (in particular Egan Ford) I was able to show a somewhat acceptable 4k module providing some multiprecision functionality during the Allschwill meeting. While by no means complete and perfect, I think it might be a decent starting point to breath some, albeit limited, multiprecision life into the HP41.
In its current state, the MPL provides  ~1000 digits, exponents up to +/2048 for each MPN (MultiPrecisionNumber)
 a complete set of basic floating point arithmetic (+,,*,/)
 some special floating point arithmetic (x^{2}, y^{x}, 1/x)
 an (almost) complete set of basic arithmetic between MPN and normal numbers (+,,*).
 MPN/NN is missing but can be easily accomplished by MPN* (1/NN).
 Harder to replicate is N/MPN, which is also missing. It can be accomplished by converting the NN into a MPN via MPN2M, followed by MP* (which is not nearly as elegant as a separate MPN/M function would be)
 special functions for fast division and multiplication by 10
 a complete set of MPN handling and I/O functions (create, set, view, get MPN, convert between MPN and NN, Copy MPN, CHS, CLX MPN, etc)
 some comparison functions (MP=0?, MP=1?)
 custom MPL error messages
 entirely in MCODE
Naturally there is an even longer list of things the MPL does not do as of today, for example  MPN comparison functions (MPNX>MPNY, etc)
 sqrt(x), e^{x}, ln(x), fact(x)
 constants pi and e to many digits
 direct division instead of the simple, yet slow Newton iteration
 more effective use of storage by storing a full 14 digits in each register. This would also speed up MP*, MPY^X and MP/ by at least 100%
 much more testing
 etc
One idea to tackle these was to create a little Open Source project. Maybe there are others that enjoy programming in MCODE and enjoy the challenge.
In the meantime, for those that are interested, please find below links to
If you do play around and discover bugs, it would be great if you can send me an email via the forum (please with steps to replicate it).
Cheers,
Peter
QRG, Error Msgs and StepbyStep
Edited: 6 Nov 2008, 9:50 p.m. after one or more responses were posted
