IsNaN throwing exception

G

Guest

Hi all

An ArithmeticException is being thrown when I call Double.IsNaN() on a double whose value is NaN. The text of the exception is:

"A first chance exception of type 'System.ArithmeticException' occurred in mscorlib.dl
Additional information: Overflow or underflow in the arithmetic operation.

This bug is hard to reproduce, but once and a while I get an unhandled exception, and Double.IsNaN() is the culprit. And when it does happen, even if I handle that exception in that location, it seems like every other call to Double.IsNaN() now throws the exception when the parameter value is NaN. Also, all of the projects in my solution have the "Check for Arithmetic Overflow/Underflow" option set to false

Does anyone know what conditions cause Double.IsNaN() to throw this exception

Thanks in advance for any help on this matter

Sincerely
Jonathan DeCarl
 
J

Jon Skeet [C# MVP]

Jonathan DeCarlo said:
An ArithmeticException is being thrown when I call Double.IsNaN() on
a double whose value is NaN. The text of the exception is:

"A first chance exception of type 'System.ArithmeticException'
occurred in mscorlib.dll Additional information: Overflow or
underflow in the arithmetic operation."

This bug is hard to reproduce, but once and a while I get an
unhandled exception, and Double.IsNaN() is the culprit. And when it
does happen, even if I handle that exception in that location, it
seems like every other call to Double.IsNaN() now throws the
exception when the parameter value is NaN. Also, all of the projects
in my solution have the "Check for Arithmetic Overflow/Underflow"
option set to false.

Does anyone know what conditions cause Double.IsNaN() to throw this
exception?

My *guess* is that it's some other piece of software on your system
which changes the processor's floating point mode. I'm afraid I don't
know much about it, but I've certainly heard of that *kind* of trouble
- although I couldn't say whether it's specifically affected
Double.IsNan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top