If this is so, how come the two values in LHS and RHS are unequal?? The type of NaN is a primitive double, not an object reference..
The simple answer here is.... The IEEE floating point standard defines it as so -- NaN does not equal NaN. And
Java is simply supporting the standard.
As a side note, the equals() method will report it as equal, if they are Double objects. This is in direct violation of the standard, and the JavaDoc states it as so. The reason this is necessary is because it will break the usability of the certain collections if NaN does not equal NaN.
Henry