C# definition for NAN (in Reflector) is not correct?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • josephbubba@hotmail.com

    C# definition for NAN (in Reflector) is not correct?

    Greetings,

    Question about how the NaN constant is defined in .NET.

    When I look at the C# definition for the System.Double NaN definition
    in Roeder's Reflector, it looks like this:

    public const double NaN = (double) 1.0 / (double) 0.0;

    However, according to the .NET documentation (and the IEEE standard),
    the actual definition is the result of dividing zero by zero (0/0).
    Dividing 1/0 is positive infinity.

    Interestingly, when I switch to the any other decompilation languages
    (ex. Visual Basic, or Managed C++), the value of NaN is not
    specifically defined as a division, but instead uses a constant. For
    example, Visual Basic looks like this:

    Public Const NaN As Double = NaN



    Is this simply a bug in Reflector for C#, or am I missing something?

    Thanks in advance.

    By the way, I'm using Reflector version 5.1.2.0 and pointing to
    the .Net framework version 2.0.50727.1433.


  • Jon Skeet [C# MVP]

    #2
    Re: C# definition for NAN (in Reflector) is not correct?

    josephbubba@hot mail.com <josephbubba@ho tmail.comwrote:
    Is this simply a bug in Reflector for C#, or am I missing something?
    Looks like a reflector bug to me.

    --
    Jon Skeet - <skeet@pobox.co m>
    Web site: http://www.pobox.com/~skeet
    Blog: http://www.msmvps.com/jon.skeet
    C# in Depth: http://csharpindepth.com

    Comment

    Working...