printf Precision: Floating-Point Types
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Floating-point types are e, E, f, g, and G.
See: ◄printf Type Characters►
Type Effect
e, E The precision specifies the number of digits to be
printed after the decimal point. The last digit is
rounded. Default precision is 6; if the precision value
is 0 or no number follows the period (.), no decimal
point is printed.
f The precision value specifies the number of digits after
the decimal point. If a decimal point appears, at least
one digit is printed before it. The value is rounded.
Default precision is 6; if the precision value is 0 or
no number follows the period (.), no decimal point is
printed.
g, G The precision specifies the maximum number of
significant digits. By default, six significant digits
are printed, less any trailing zeros that are truncated.
-♦-