I have a question if there is a value in Java that is equivalent to Double.NaN
.
It is common knowledge that Double.NaN
is equivalent to Double.longBitsToDouble(0x7ff8000000000000L)
.
I tried this in C++:
long d = (long)0x7ff8000000000000L;
cout << setprecision(308) << *((double*)&d) << endl;
and recieved this number: 1.7913854515396173439813246875759771148370355414969747463437939834712133067539348971091007957318376384187247712070435161526222960236442304023361887799416099781498803833913104211684781256626064276104912473088500848240020138295465213393610297503047186864315005421110542290050185011298999959710557864144337912608e-307
. But I tried this in Java and it didn't work. Is there a double equivalent to Double.NaN
in Java?