Red Hat Bugzilla – Bug 77152
printf man page inconsistent with what glibc does
Last modified: 2005-10-31 17:00:50 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3; Linux)
Description of problem:
The man page for printf says that a negative precision for floating point
numbers is treated as 0. Glibc acts as if a negative precision is treated as
if no precision was given and glibc's own documentation confirms this.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Save test.c somewhere.
2. Go there and run: make test
(Expected results based on erroneous information from man printf.)
Created attachment 83084 [details]
Test source code to reproduce problem.
fixed in man-pages-1.58-1:
> A negative field width is taken as a `-' flag followed by a positive field width.
oops, you were talking about the PRECISION.
You're right: according to C99 and C89 (and the glibc info pages), if you write
a negative number for the precision, the default precision should apply, not
zero nor the absolute value.
corrected in the POSIX version of the printf man-pages-1.66
to get the POSIX version, invoke man with
man 3p printf