I just got a question that I can\'t answer.
Suppose you have this loop definition in Java:
while (i == i) ;
What is the type of
Since others said it's NaN I got curious about the official (JDK 6) implementation of Double.isNaN
, and behold:
/**
* Returns true
if the specified number is a
* Not-a-Number (NaN) value, false
otherwise.
*
* @param v the value to be tested.
* @return true
if the value of the argument is NaN;
* false
otherwise.
*/
static public boolean isNaN(double v) {
return (v != v);
}