Table of content

What is double in java

The double keyword is a data type that can store fractional numbers or decimal numbers. The double data type is of 8 bytes size.

The double data type is a double precision 64 bit IEEE 754 floating point. The range of double is greater than float data type. It is a not good approach to use double for precise value.

The range of double data type is 4.94065645841246544e-324d to 1.79769313486231570e+308d. The double data type can be used to store up to 15 decimal places.

The minimum value double data type can hold is 4.9e-324 and the maximum value is 1.7e+308. The default value is 0.0d.

While declaring a double data type it should be terminated with d. For example double x = 457.0292d; double y = 32456.8876234d.

The example program below illustrates the declaration and use of double data type.

public static void main(String[] args) {
   double x = 581216732.323433;
   double y = 7.83684987683688;
   double sum = x + y;
   System.out.println("Result :" + sum);
 }

The output is

Result :5.81216740160283E8
0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions