In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/bfea06111a748a3087983fe3342c57695202d016?hp=9d293ddbfa9b2d5f12e8b7a40b44c1466fc9f148>
- Log ----------------------------------------------------------------- commit bfea06111a748a3087983fe3342c57695202d016 Author: Tony Cook <[email protected]> Date: Mon May 16 10:59:13 2016 +1000 Maxwell Carey is now a perl author M AUTHORS commit 0533ae6f60432c9f45178df2a58a9b469f4e3464 Author: Maxwell Carey <[email protected]> Date: Mon May 9 15:33:41 2016 -0600 Clarify description of sprintf "%.1g" sprintf "%.1g" sets the number of *significant* digits, not the maximum number of digits to show. Added examples for values less than 1. M pod/perlfunc.pod ----------------------------------------------------------------------- Summary of changes: AUTHORS | 1 + pod/perlfunc.pod | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 167efd9..a055b67 100644 --- a/AUTHORS +++ b/AUTHORS @@ -831,6 +831,7 @@ Matsumoto Yasuhiro <[email protected]> Maurizio Loreti <[email protected]> Max Baker <[email protected]> Max Maischein <[email protected]> +Maxwell Carey <[email protected]> Merijn Broeren <[email protected]> Michael A Chase <[email protected]> Michael Breen <[email protected]> diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index e9c7038..5c778f1 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -7745,9 +7745,8 @@ For example: printf '<%e>', 10; # prints "<1.000000e+01>" printf '<%.1e>', 10; # prints "<1.0e+01>" -For "g" and "G", this specifies the maximum number of digits to show, -including those prior to the decimal point and those after it; for -example: +For "g" and "G", this specifies the maximum number of significant digits to +show; for example: # These examples are subject to system-specific variation. printf '<%g>', 1; # prints "<1>" @@ -7757,6 +7756,9 @@ example: printf '<%.2g>', 100.01; # prints "<1e+02>" printf '<%.5g>', 100.01; # prints "<100.01>" printf '<%.4g>', 100.01; # prints "<100>" + printf '<%.1g>', 0.0111; # prints "<0.01>" + printf '<%.2g>', 0.0111; # prints "<0.011>" + printf '<%.3g>', 0.0111; # prints "<0.0111>" For integer conversions, specifying a precision implies that the output of the number itself should be zero-padded to this width, -- Perl5 Master Repository
