int i = 0, j = 0;
double nan1 = (double)0/0;
double nan2 = (double)0/0;
double nan3 = (double)i/j;
System.out.println(Double.doubleToRawLongBits(nan1) == Double.doub
I think Java follows IEEE 754. In this case NaN has more than one possible bit representation. The two representations in your case differ in the "sign" bit. The value of the sign bit seems to be not defined by the standard and is usually ignored. So both values are correct. See http://en.wikipedia.org/wiki/NaN