File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -7745,9 +7745,8 @@ For example:
7745
7745
printf '<%e>', 10; # prints "<1.000000e+01>"
7746
7746
printf '<%.1e>', 10; # prints "<1.0e+01>"
7747
7747
7748
- For "g" and "G", this specifies the maximum number of digits to show,
7749
- including those prior to the decimal point and those after it; for
7750
- example:
7748
+ For "g" and "G", this specifies the maximum number of significant digits to
7749
+ show; for example:
7751
7750
7752
7751
# These examples are subject to system-specific variation.
7753
7752
printf '<%g>', 1; # prints "<1>"
@@ -7757,6 +7756,9 @@ example:
7757
7756
printf '<%.2g>', 100.01; # prints "<1e+02>"
7758
7757
printf '<%.5g>', 100.01; # prints "<100.01>"
7759
7758
printf '<%.4g>', 100.01; # prints "<100>"
7759
+ printf '<%.1g>', 0.0111; # prints "<0.01>"
7760
+ printf '<%.2g>', 0.0111; # prints "<0.011>"
7761
+ printf '<%.3g>', 0.0111; # prints "<0.0111>"
7760
7762
7761
7763
For integer conversions, specifying a precision implies that the
7762
7764
output of the number itself should be zero-padded to this width,
You can’t perform that action at this time.
0 commit comments