Floating Point Types
Integers and characters are integral types: the values of these types are separated from each other by values that are multiples of one. They cannot contain fractional parts. Or, rather, whatever bit pattern they contain, that bit pattern cannot be interpreted by the C++ compiler as a fraction. Other types are used if the fractional part is needed.
C++ does not have fixed point numbers that would give the programmer control over the number of digits after the decimal point. Instead, the programmer can use floating point values that consist of a mantissa (with whole and fractional parts) and an exponent. The exponent is expressed in literal numbers as a power of ten, but in the computer memory it is, of course, expressed ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access