Re: [xml] NAN problems on Win32



"Vakoc, Mark" wrote:

few reports of crashes of my program from various people.  Only the latest
version of my program has the crash handler that generates that log with the
stack trace, so I cannot be sure that they had the exact same problem.  If I

The crash handler may very well be the problem.

IEEE 754 states that:

 o infinity/infinity (just as 0/0) is an invalid operation,
 o it must be possible to install a trap handler to catch such exceptions,
 o if no trap handler is installed, then an invalid operation must return
   NaN.

trio_nan() uses infinity/infinity as its fallback solution to generate NaN.
You have installed a trap handler, and you are receiving an invalid operation
trap.

If you look at the source code for trio_nan(), you will notice that this
problem has been addressed on Unix, where floating-point exceptions (SIGFPE)
are ignored during the operation.

There may be two possible solutions to this problem (apart from removing
your crash handler)

 1. Ignore the floating-point exception during the operation, just like on
    Unix. I don't know if signal() on Windows can do this, and if not, how
    this must be done instead.

 2. Figure out why USE_IEEE_754 isn't defined, as it would avoid performing
    the illegal operation. My guess is that a double is longer than 64-bits
    (and thus DBL_MANT_DIG would be greater than 53).

One interesting note:  trionan returns different values for them as for me.
For me pinf/pinf returns NAN, whereas it returns 0 for them.

Strange, it should not return 0.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]