Post Reply 
HP PRIME not raising overflow/underflow may cause critical errors
03-18-2021, 08:35 PM
Post: #1
HP PRIME not raising overflow/underflow may cause critical errors
Apologies if this has already been reported as an issue (I checked with a quick web search but could not find a similar post).

I noticed that an HPPL program I wrote suffered from internal overflow and subsequent underflow. This produced garbage results by the program, which could easily be interpreted as legitimate output.

Consider the following statements in HOME or HPPL:

F := 3.1415926E499
G := 2E250
P := F/G^2


Because G^2 overflows, I would expect F/G^2 to underflow, but that is not what happens. If the overflow or underflow is not caught as a floating point exception, then at least the value should be +0 or NaN as a result of dividing F by +inf. But this is not the case:

F/G^2
0.31415926


I would expect this to be pi/40:


0.07853981...


This means that arithmetic can be broken at times:

H := G/2
F/G^2==1/4*F/H^2
0
F/G^2==F/G/G
0


which are both false (zero) according to the HP PRIME. Worse, the wrong values can still be compared to give the wrong true/false results, because they are not NaN. If they were NaN then all relational comparisons should be false as per IEEE 754.

The HP-71B with DEFAULT OFF produces an exception and with DEFAULT ON gives a warning. Unlike the HP-71B, it appears that common floating point standards (IEEE 754) are not followed by the HP PRIME, or am I wrong?

Has the HP PRIME any fp flags that can be set to raise internal fp overflow exceptions?

Why is there at least no warning message?

Why does IFERR in a HPPL program not catch overflow?

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP PRIME not raising overflow/underflow may cause critical errors - robve - 03-18-2021 08:35 PM



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