EN
Java - min double value
4 points
In Java, min double number value can be achieved using -Double.MAX_VALUE
what is equal to -1.7976931348623157e+308
.
Practical example:
xxxxxxxxxx
1
package example;
2
3
public class Program {
4
5
public static void main(String[] args) {
6
7
System.out.println(-Double.MAX_VALUE); // -1.7976931348623157e+308 or in hex: -0x1.fffffffffffffP+1023
8
}
9
}
Output:
xxxxxxxxxx
1
-1.7976931348623157e+308
Warning: do not confuse
Double.MIN_VALUE
with double minimal value - it returns min positive double value.
Sometimes it is necessary to know minimal positive double value. To get its we can use Double.MIN_VALUE
.
xxxxxxxxxx
1
package example;
2
3
public class Program {
4
5
public static void main(String[] args) {
6
7
// Min positive double value:
8
//
9
System.out.println(Double.MIN_VALUE); // 4.9e-324 or in hex: 0x0.0000000000001P-1022
10
}
11
}
Output:
xxxxxxxxxx
1
4.9e-324