
Ismael Lanchas thinks this is interesting:
When Equals and == are not equal
We said earlier that it’s sometimes useful for ==
and Equals
to apply different definitions of equality. For example:
double x = double.NaN; Console.WriteLine (x == x); // False Console.WriteLine (x.Equals (x)); // True
The double
type’s ==
operator enforces that one NaN can never equal anything else—even another NaN. This is most natural from a mathematical perspective, and it reflects the underlying CPU beha...
Minimise