Post Reply 
Assorted WP-34S beginner questions
07-30-2014, 05:44 AM
Post: #26
RE: Assorted WP-34S beginner questions
(07-27-2014 11:47 AM)Paul Dale Wrote:  I don't bother tracking stuff down into the bowels of the decNumber library. The low level arithmetic functions are pretty convoluted -- they have to work with arbitrary precision, they have to correctly round and they need to be reasonably efficient.
I, on the other hand, am now starting to understand more - and may even try modifying some of the code.

By deliberately limiting the precision to 4096 digits, and merging with 4 status bits, for example. Result fits into a 16-bit integer, instead of being spread over five bytes, and keeps al variables word-aligned.

There's also DECPUN (Decimal numbers per unit), which defaults to 3. Changing this should reduce the number of bytes needed to hold variables - at the expense of computing speed. According to DecNumber Tuning Parameters, anyway.

Setting DECPUN to 9 (3 groups of 3 packed BCD numbers = 30 bits) stored in a 32 bit double-word gives 45 digits in 20 bytes, vs the current 39 digits in 26 bytes.

Is the saved memory worth the extra effort? A good question.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Code Reading for Dummies - sa-penguin - 07-21-2014, 10:08 AM
RE: Assorted WP-34S beginner questions - sa-penguin - 07-30-2014 05:44 AM



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