summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Hall <chall0@gmail.com>2013-09-02 15:41:56 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2013-09-04 09:26:28 +0200
commitabbcef30df66e01e4afc5d676c20ce43d995d017 (patch)
treee373901c34603eea62c1f40442144b537165b2c6
parent7d0ec5b670e739f8030b04263325e605e5c935b0 (diff)
printf.3: Correctly describe the meaning of a negative precision
The printf(3) manpage says that a negative precision is taken to be zero, whereas printf(3p) says that a negative precision is taken as if the precision were omitted. glibc agrees with the latter (POSIX) specification. Test code: printf("%f\n",42.0); // "42.000000" printf("%.*f\n",0,42.0); // "42" printf("%.*f\n",-1,42.0); // "42.000000" This patch corrects the explanation to match what actually happens. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
-rw-r--r--man3/printf.37
1 files changed, 4 insertions, 3 deletions
diff --git a/man3/printf.3 b/man3/printf.3
index f5e96d3e..61f8e4d5 100644
--- a/man3/printf.3
+++ b/man3/printf.3
@@ -31,7 +31,7 @@
.\" 2000-07-26 jsm28@hermes.cam.ac.uk - three small fixes
.\" 2000-10-16 jsm28@hermes.cam.ac.uk - more fixes
.\"
-.TH PRINTF 3 2013-03-05 "GNU" "Linux Programmer's Manual"
+.TH PRINTF 3 2013-09-04 "GNU" "Linux Programmer's Manual"
.SH NAME
printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf,
vsnprintf \- formatted output conversion
@@ -409,8 +409,9 @@ Instead of a decimal digit string one may write "*" or "*m$"
is given in the next argument, or in the m-th argument, respectively,
which must be of type
.IR int .
-If the precision is given as just \(aq.\(aq, or the precision is negative,
-the precision is taken to be zero.
+If the precision is given as just \(aq.\(aq, the precision is taken to
+be zero. A negative precision is taken as if the precision were
+omitted.
This gives the minimum number of digits to appear for
.BR d ,
.BR i ,