New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] Clarify description of sprintf "%.1g" in perlfunc #15313
Comments
From maxwellhaydn@gmail.comCreated by maxwellhaydn@gmail.comDescription of sprintf "%.1g" in perlfunc is unclear. This sets Perl Info
|
From maxwellhaydn@gmail.com0001-Clarify-description-of-sprintf-.1g.patchFrom f1451f94ba642fcea98a383f9a796ab2c7c5265f Mon Sep 17 00:00:00 2001
From: Maxwell Carey <maxwellhaydn@gmail.com>
Date: Mon, 9 May 2016 15:33:41 -0600
Subject: [PATCH] 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.
---
pod/perlfunc.pod | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
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,
--
1.8.3.1
|
From @tonycozOn Mon May 09 14:57:49 2016, maxwellhaydn@gmail.com wrote:
Thanks, applied as 0533ae6. Add you to AUTHORS in bfea061. Tony |
The RT System itself - Status changed from 'new' to 'open' |
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.26.0, this and 210 other issues have been Perl 5.26.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#128105 (status was 'resolved')
Searchable as RT128105$
The text was updated successfully, but these errors were encountered: