I am stuck trying to find out why these two operations return different values:
Double.NaN == Double.NaN
returns false
Do
At the very bottom of the remarks section of Double.Equals
, you will find:
If two Double.NaN values are tested for equality by calling the Equals method, the method returns true. However, if two NaN values are tested for equality by using the equality operator, the operator returns false. When you want to determine whether the value of a Double is not a number (NaN), an alternative is to call the IsNaN method.