Silverfrost Forums

Welcome to our forums

Invalid Floating Point Number exception

7 Apr 2025 9:16 #32076

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.

8 Apr 2025 7:14 #32077

'Invalid Floating Point Number' is runtime error number 27 in the FTN95 library but I can't see any reference to it .

8 Apr 2025 9:59 #32080

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.

9 Apr 2025 6:14 #32081

One possibility is to use the IEE_ARITHMETIC module and a call to

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.

9 Apr 2025 9:33 #32082

Thanks, Paul. I'm going to experiment with this a bit!

Bill

Please login to reply.