View previous topic :: View next topic |
Author |
Message |
wahorger

Joined: 13 Oct 2014 Posts: 1255 Location: Morrison, CO, USA
|
Posted: Mon Apr 07, 2025 10:16 pm Post subject: Invalid Floating Point Number exception |
|
|
I have a customer who told me that an "Invalid Floating Point Number" had been raised, and the error box disappeared and the program halted.
I am looking for either a way to flag where the error occurred, or to acknowledge the error by substituting a different value (valid, of course) and flagging the error and continuing.
Any insights would be helpful.
It is possible that a variable does not get initialized properly; without a location given, it will be impossible. The error does not appear to be repeatable; however, I will ask my user to re-run his data a few time, JIC. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8167 Location: Salford, UK
|
Posted: Tue Apr 08, 2025 8:14 am Post subject: |
|
|
"Invalid Floating Point Number" is runtime error number 27 in the FTN95 library but I can't see any reference to it . |
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1255 Location: Morrison, CO, USA
|
Posted: Tue Apr 08, 2025 10:59 pm Post subject: |
|
|
I put in the call to trap FP exceptions (Win32). This is a random occurrence so far as I can tell; likely my problem with some FP I don't properly initialize. Still...
It would be helpful to know how to force an invalid FP number (and other exceptions) to see if it now ignores the error, or still crashes. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8167 Location: Salford, UK
|
Posted: Wed Apr 09, 2025 7:14 am Post subject: |
|
|
One possibility is to use the IEE_ARITHMETIC module and a call to
Code: | x = ieee_value(x,IEEE_QUIET_NAN) |
Using x might give the desired result.
Otherwise the TRANSFER function can be used to to set an integer hexadecimal value and convert it to REAL.
For example, a 32 bit NAN has 255 in the exponent part and non-zero in the fractional part. |
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1255 Location: Morrison, CO, USA
|
Posted: Wed Apr 09, 2025 10:33 pm Post subject: |
|
|
Thanks, Paul. I'm going to experiment with this a bit!
Bill |
|
Back to top |
|
 |
|