As I said, MSDN requires an inherited Equals to return true for x.Equals(x) unless x is of type float/double, in which case there is no such requirement at all. Your point on one NaN not being equal to another NaN is absolutely valid; anyway, x.Equals(y) is not supposed to first check if x and y refer to the same object. So if they both refer to the same float variable and that happens to be NaN, then is really should return wouldn't be wrong to return false! AFAIK the same argument applies to plus and minus infinity, one infinity does not equal another. :)
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
modified on Sunday, June 21, 2009 2:14 PM