Floating-Point Number Precision and Memory Requirements
Variables of type
float represent single-precision floating-point numbers and have approximately seven significant digits on most of today’s systems. Variables of type
double represent double-precision floating-point numbers. These require twice as much memory as
float variables and provide approximately 15 significant digits on most of today’s systems—approximately double the precision of
float variables. Most programmers represent floating-point numbers with type
double. In fact, C++ treats all floating-point numbers you type in a program’s source code (such as 7.33 and 0.0975) as
double values by default. Such values in the source code are known as floating-point literals. See Appendix ...