I am stuck trying to find out why these two operations return different values:
Double.NaN == Double.NaN
returns false
Do
Well, Oded's answer is great but I want to say something;
When I decompile Double.Equals()
method, it seems like this;
public bool Equals(double obj)
{
return ((obj == this) || (IsNaN(obj) && IsNaN(this)));
}
So since we have this = Double.NaN and obj = Double.NaN
(IsNaN(obj)) and (IsNaN(this)) returns `true`.
So basicly it is could return ((obj == this) || true
which is equvalent to
return ((obj == this)
is true
.