29.5. Printing Floating-Point Numbers

A floating-point value contains a decimal point, as in 33.5, 0.0 or -657.983. Floatingpoint values are displayed in one of several formats. Figure 29.3 describes the floatingpoint conversions. The conversion characters e and E display floating-point values in computerized scientific notation (also called exponential notation). Exponential notation is the computer equivalent of the scientific notation used in mathematics. For example, the value 150.4582 is represented in scientific notation in mathematics as

Figure 29.3. Floating-point conversion characters.
Conversion characterDescription
e or EDisplay a floating-point value in exponential notation. When conversion character E is used, the output is displayed ...

Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.