Double Precision Floating Point Data Type
How is "double" datatype used in C++?.
Explanation
The
"double" precision floating point data type is used to represent floating point numbers that occupies 8 bytes. The range of values for the "double" datatype is between +/- 1.7e to +/- 308.
Example :
#include <iostream.h> void main() { double a = 1000000.0; cout << "Double Precision Floating Point is:" << a << '\n'; cout << "Bytes occupied is:" << sizeof(a); } |
Result:
Double Precision Floating Point is: 1e+06
Bytes occupied is: 8
In the above example, the value of the double floating point number is displayed along with the bytes occupied by the "double" data type.