Java: Why's Double.MIN_VALUE is positive? Integer.MIN_VALUE is negative!
Double.MIN_VALUE holds the value 2-1022. This is a positive value, as opposed to
Integer.MIN_VALUE which holds the value -2147483648.
The reason is most likely that the smallest double value is easily expressed as
-Double.MAX_VALUE. The IEEE 754 format has one bit reserved for the sign and the remaining bits representing the magnitude. This means that it is symmetrical around origo (as opposed int values, which have one more negative value).
So what’s up with 2-1022?
This value is the smallest value greater than 0 that the IEEE 754 allows you to express. So
Double.MAX_VALUE) should be thought of as the minimum (and maximum) positive magnitudes.
Here is a good text on the subject.
Finally, the same constant is called
Double.EPSILON in .NET, which is arguably a better name.