'Why Double.compare(Double.NaN, Double.POSITIVE_INFINITY) returns 1, means Double.NaN is greater than Double.POSITIVE_INFINITY in Java?
System.out.println(Double.compare(Double.NaN, Double.POSITIVE_INFINITY)); // result: 1
Why Double.NaN
is greater than Double.POSITIVE_INFINITY
in Java? Does Double.NaN
is greater than anything including infinity?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|