I found a bug in my code which boiled down to comparing Double(0.0)
with Double.MIN_VALUE
. Essentially, the following returns false:
System.out.println(0.0 > Double.MIN_VALUE);
How is this possible?
I found a bug in my code which boiled down to comparing Double(0.0)
with Double.MIN_VALUE
. Essentially, the following returns false:
System.out.println(0.0 > Double.MIN_VALUE);
How is this possible?
Double.MIN_VALUE is the smallest positive non-zero value which can be represented by a Java double (see the JavaDoc at http://download.oracle.com/javase/8/docs/api/java/lang/Double.html).
According to the javadoc for Double.MIN_VALUE, MIN_VALUE is:
So Double.MIN_VALUE is not negative, it's the positive value that's as close as a Double can get to zero (without being zero).