Writing Floating-Point Numbers
C++ has two ways of writing floating-point numbers. The first is to use the standard decimal-point notation you’ve been using much of your life:
12.34 // floating-point939001.32 // floating-point0.00023 // floating-point8.0 // still floating-point
Even if the fractional part is 0, as in 8.0, the decimal point ensures that the number is represented in floating-point format and not as an integer. (The C++ Standard does allow for implementations to represent different locales—for example, providing a mechanism for using the European method of using a comma instead of a period for the decimal point. However, these choices govern how the numbers can appear in input and output, ...
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