Extended precision library

05232019, 08:34 AM
(This post was last modified: 05232019 09:02 PM by G.E..)
Post: #1




Extended precision library
Hello,
In the 11th issue of the french journal "La Gazette des Pocketicaires", I published an extended precision package for the HP Prime (starts on page 22). Would you mind give me your opinion on this ? There are still some subtle issues on precision for logarithms. The journal is seeking contributions at the moment, they don't need to be in French. You're welcome if you want to drop a couple of pages or more ! Thank you G.E. 

05232019, 09:02 PM
Post: #2




RE: Extended precision library
Sorry here is a link...
http://silicium.org/site/index.php/telec...keticaires 

05242019, 04:52 AM
Post: #3




RE: Extended precision library
Nice, what language did you write them in, what precision and can it be used on other platforms (e.g. microcontrollers)?


05242019, 10:20 AM
Post: #4




RE: Extended precision library
Hello,
It is simple PPL code. Precision is chosen by the user but more than a hundred digits will be slow. Transcendental functions have a precision problem (half the digits only will be correct usually), I hope to fix it, don't hesitate to post suggestions. Ideas welcome ! G.E. 

05242019, 12:59 PM
Post: #5




RE: Extended precision library
Thanks for sharing info on this newsletter. In addition to your interesting looking article, there are additional articles on the 16C, 75C, Sharp PC1211, and others. While translation tools will help somewhat, I really wish I could read French.
Bob Prosperi 

05242019, 01:46 PM
(This post was last modified: 05242019 01:48 PM by StephenG1CMZ.)
Post: #6




RE: Extended precision library
Precision
Dan, as I understand it the digits are stored in a list, with 6 digits per item in the list. The HP Prime PPL allows up to 10 000 items in a list. So that suggests an upper limit of 60 000 digits that can be stored in that format  less about a dozen digits because a couple of items in the list are used for exponent etc. Stephen Lewkowicz (G1CMZ) 

05252019, 12:43 AM
Post: #7




RE: Extended precision library
Hi, G.E.: (05232019 08:34 AM)G.E. Wrote: [...]I published an extended precision package for the HP Prime [...] Would you mind give me your opinion on this ? I've done a cursory read of the "basic arithmetic" part, up to the Square Root code, but not having a Prime I can't really comment on the actual running performance. That said, at first sight the division code seems to me somewhat inefficient, there are better ways to implement multiprecision division, IMHO, (see point 9 below) and as many additional functions fully depend on it (Square Root, transcendental functions, etc.) it's essential for its code to be highly efficient and in particular as fast as possible, lest it'll be the weakest link on the chain, the bottleneck so to say. Many years ago (16 June 2002) I posted my "Short & Sweet Math Challenge #4" to the old MoHP forum, which dealt with some multiprecision tasks and to ease the burden on the challengetakers I included there what I titled as "12 Guidelines for writing a multiprecision program/library/package for your HP calculator". Quoting from said challenge, with some expanded bits (keep in mind that this was written for the 10digit HP41C, scale it to use the extra digits the Prime allows instead): " There are many ways to do it, but you can follow these simple guidelines. They aren't optimal, but will get the job done easily:
Perhaps some of this could be of help to you or some other people reading this thread. Also, all the multiprecision operations and results found in S&SMC#4 might be useful to you for testing your routines. Have a nice weekend. V. 

05252019, 10:30 AM
Post: #8




RE: Extended precision library
Hello,
Thank you rprosperi for your kind words. Valentin, first of all I really appreciate all your work (SSMC, "Long Live...", lots...), always interesting and enlightening to read all your ideas. On your points I have followed these almost exact steps, and have these remarks : 1. Fixed format is nice but there is always a case when you "need" more digits. Also due to precision loss on higher functions, it is simpler to raise the number of digits rather than fix the damn algorithm. 9. Yes, absolutely right, the division algorithm is an horrible kludge ! I tried to find an efficient way, and will try the Newton method you show. 11. The precision of the constant PI must be adjustable, the right way I think is as 4*atan(1). 12. I don't like series very much for calculations, they tend to be slow and imprecise, being a CORDIC fan :) Can't seem to find the SSMC#4 at the moment, will see. I posted the programs in the Prime Library for interested people to try. Regards, G.E. 

05252019, 11:40 AM
(This post was last modified: 05252019 11:41 AM by pier4r.)
Post: #9




RE: Extended precision library
(05252019 10:30 AM)G.E. Wrote: Can't seem to find the SSMC#4 at the moment, will see. https://www.hpmuseum.org/cgisys/cgiwrap...read=19014 and tribute to Eric outstanding work. https://archived.hpcalc.org/museumforum/...order=desc edit. I forgot. Thanks for sharing and nice that the french community is so active on calculators! I wish it would be so also elsewhere! Wikis are great, Contribute :) 

05252019, 06:36 PM
Post: #10




RE: Extended precision library
.
Hi again, G.E.; (05252019 10:30 AM)G.E. Wrote: Valentin, first of all I really appreciate all your work (SSMC, "Long Live...", lots...), always interesting and enlightening to read all your ideas. Thank you very much for your interest, much appreciated. Quote:1. Fixed format is nice but there is always a case when you "need" more digits. Also due to precision loss on higher functions, it is simpler to raise the number of digits rather than fix the damn algorithm. Of course, you're right. As I said, this was written 17 years ago and was intended to help HP41C owners to implement sometihng in order to have a try at my challenge. I'd use a different approach now, and even did at the time. For instance, I created a Windows app which implemented a fully programmable RPN calculator with lots of extras, such as the XYZTL stack being visible at all times, 999 registers, 999 program steps, 999 labels, full alphanumerics, full mathematical functions, constants, the works, and of interest for this discussion, multiprecision up to 256 decimal digits, which was all I cared for at the time. It was nice to be able to instantly compute Gamma of a 256decimals argument to 256 correct digits, finding roots of equations to 50, 100, 200 or 256 digits (the precision was selectable), all in perfect, compatible RPN with many extensions (full stack and register manipulations, for instance). I wrote the user interface in VB, for simplicity, which called a DLL I wrote in Turbo Pascal 5.0, implementing all the multiprecision functionalities at blinding speed thanks to optimized, compiled code. My DLL had full arithmetic, powers, trigs, exponential, logarithm, Gamma, Factorials, Lambert W and common multiprecision constants defined up to 256 digits (Pi, e, Phi, EulerGamma, etc) for instant recall. I never released it, it was written before I had decent Internet access, must be there somewhere. Quote:9. Yes, absolutely right, the division algorithm is an horrible kludge ! I tried to find an efficient way, and will try the Newton method you show. Please do, it's what I used for my TP DLL library and it did well for me. Quote:11. The precision of the constant PI must be adjustable, the right way I think is as 4*atan(1). But there's no use in having to recompute it each time or even once at the beginning. Simply have it inside the initialization part of your library, defined as an explicit constant (say 1024 digits) which you'll simply trim to the specified precision (say 200 digits) without having to call the arctan function. If the result is fixed and known, what's the use in computing it ? You already know what result the Atan will give ! Don't use time and memory to compute a known constant, simply define and use the constant. Quote:Can't seem to find the SSMC#4 at the moment, will see. I see that pier4r (thanks, Pier!) already pointed you to two versions of it. You'll find the Guidelines there and several examples which you can use for testing purposes. Have a nice weekend. V. . 

06022019, 09:56 AM
Post: #11




RE: Extended precision library
Hello,
I see someone uploaded my library to hpcalc.org. This was done very well and faithfully, so thank you ! G.E. 

06022019, 05:35 PM
Post: #12




RE: Extended precision library
Likely that was Eric, that is doing a great job behind the scenes.
Wikis are great, Contribute :) 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)