Originally posted by P Ventura:

...why the following code prints "True"? It's a comparison between

two constants!? ...

Actually, it prints "False."

Yes, these are "constants," but they are constants representing things that are

**Not a Number.** And because these are not real numbers, they cannot be compared in a real ordinal manner. That is, from a real number perspective, we can't say that one is greater than, less than, or equal to another. So these operations return false (with the exception of NaN != NaN, which must return true since NaN == NaN returns false).

For example, consider that NaN might represent Math.sqrt(-1), or it might represent Math.sqrt(-987654). Neither of these are real numbers, but they're not equal either.