Post Reply 
RPN-PRGM: New Windows console application emulating HP calculators
01-29-2021, 01:50 PM
Post: #12
RE: RPN-PRGM: New Windows console application emulating HP calculators
(01-28-2021 04:16 PM)Aacini Wrote:  [*] The management of 80-bits floating point numbers, that allows to enter and display numbers with 19 decimal digits and an exponent of ten above 4000.

Hi, Aacini

It may be better if display numbers extended to 21.
Minimum digits d that will round-trip b bits: d = ceil(b*(log(2)/log(10))) + 1

53 bits → d = ceil(15.9546) + 1 = 17       // double precision
64 bits → d = ceil(19.2659) + 1 = 21       // extended precision

Better yet, have an option to enter/display hex-float.

---

Is this a RPN.exe bug ?

I use 1e16 + 2.9999 to test for rounding behavior (note: 1e16 slightly bigger than 2^53)

With double precision, 2.9999 get rounded-down, sum = 1e16 + 2
With extended precision, 2.9999 get rounded-up, sum = 1e16 + 3
If extended precision then round-back to double, sum = 1e16 + 4

But, this is not what observed:

> RPN.exe 1e16 2.9999 + eng:19    ; note: eng:19 is 19 digits, not 20
10.00000000000000300E+0015

> RPN.exe 1e16 2.9999 + fix:0       ; should hit with double-rounding errors, returning 1e16+4
10000000000000002

For some strange reason, the flip occurs much higher:

>RPN.exe 1e16 3.00634 + fix:0
10000000000000002

>RPN.exe 1e16 3.00635 + fix:0
10000000000000004

---

A minor issue, numbers starting with decimal point are not recognized:

RPN: .123
Invalid operator: .

RPN: -.123
Wrong number: -.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: RPN-PRGM: New Windows console application emulating HP calculators - Albert Chan - 01-29-2021 01:50 PM



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