IsNaN throwing exception

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jonathan DeCarlo (anonymous_at_discussions.microsoft.com)
Date: 05/06/04


Date: Thu, 6 May 2004 13:51:04 -0700

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.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?

Thanks in advance for any help on this matter.

Sincerely,
Jonathan DeCarlo



Relevant Pages

  • Re: IsNaN throwing exception
    ... > An ArithmeticException is being thrown when I call Double.IsNaNon ... > unhandled exception, ... > exception when the parameter value is NaN. ...
    (microsoft.public.dotnet.framework)
  • Comparing to float.NaN throws ArithmeticException
    ... We have a DLL compiled under Borland C++ Builder 5 calling an exported C ... private void Initialize(FontFamily family, float emSize, FontStyle ... This expression throws an ArithmeticException exception with the message ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Unhandled Exception
    ... "ArithmeticException is the base class for DivideByZeroException, ... NotFiniteNumberException, and OverflowException. ... the derived classes of ArithmeticException to more precisely indicate ... > I have already restore my VB.NET but still I get this exception. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Use cases for quiet NaN comparison?
    ... that something has gone fundamentally wrong in a calculation, and the NaN ... having no sane result should produce an exception. ... preferable to raising an exception since the Kriging algorithm ...
    (sci.math)
  • Re: Division durch Null
    ... IMO gibt es nicht nur INF, sondern sogar +/- INF und NAN. ... |x87 control word) and the operation causes a zero-divide exception (sets ... |the ZE bit in the x87 status word to 1), ...
    (de.comp.lang.c)