Languages
[Edit]
EN

Java - min double value

4 points
Created by:
WGates
412

In Java, min double number value can be achieved using -Double.MAX_VALUE what is equal to -1.7976931348623157e+308.

Practical example:

package example;

public class Program {

	public static void main(String[] args) {

		System.out.println(-Double.MAX_VALUE);  // -1.7976931348623157e+308    or in hex: -0x1.fffffffffffffP+1023
	}
}

Output:

-1.7976931348623157e+308

Warning: do not confuse Double.MIN_VALUE with double minimal value - it returns min positive double value.

 

Min positive double value

Sometimes it is necessary to know minimal positive double value. To get its we can use Double.MIN_VALUE.

package example;

public class Program {

	public static void main(String[] args) {

		// Min positive double value:
		//
		System.out.println(Double.MIN_VALUE);  //  4.9e-324    or in hex:  0x0.0000000000001P-1022
	}
}

Output:

4.9e-324

 

See also

  1. Java - max double value

  2. Java - min float value

  3. Java - max float value

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join