Post Reply 
[Free42] Numbers reformatted in program mode
07-23-2018, 03:25 PM
Post: #9
RE: [Free42] Numbers reformatted in program mode
(07-23-2018 08:21 AM)Paul Dale Wrote:  With BCD coded reals, there is no digit conversion required Smile

Yes, and that's why the HP-42S can store numbers that way and still be fast. Smile
It's not as easy with base-10000 or BID, though!

(07-23-2018 08:21 AM)Paul Dale Wrote:  It must have been fun dealing with binary floating point numbers and decimal fractions that change the number. 0.1 being converted to 0.1000000000000000055511151231257827021181583404541015625 when stored as an IEEE 64 bit number. I guess digits after the 12th can be rounded away which gives a solution.

While I was still supporting PalmOS, and therefore unable to use the Standard C Library, it was a pain. After dropping PalmOS, the code became a lot simpler:

Code:
sprintf(decstr, "%.15e", d);

followed by the existing logic to massage the string representation to match the HP-42S display modes.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [Free42] Numbers reformatted in program mode - Thomas Okken - 07-23-2018 03:25 PM



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