java - Why does Double.NaN==Double.NaN return false? - Stack Overflow
NaN means Not a Number. What is not a number? Anything. You can have anything in one side and anything in the other side, so nothing guarantees that both are equals. NaN is calculated with Double.longBitsToDouble(0x7ff8000000000000L) and as you can see in the documentation of longBitsToDouble:
If the argument is any value in the range
0x7ff0000000000001Lthrough0x7fffffffffffffffLor in the range0xfff0000000000001Lthrough0xffffffffffffffffL, the result is aNaN.
Also, NaN is logically treated inside the API.
Read full article from java - Why does Double.NaN==Double.NaN return false? - Stack Overflow
No comments:
Post a Comment