Re: [patch] printf.3: correctly describe the meaning of a negative precision

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/02/13 16:41, Christopher Hall wrote:
> 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.

Thanks for the thorough and clear report, Chris. Patch applied.

Cheers,

Michael


> diff --git i/man3/printf.3 w/man3/printf.3
> index f5e96d3..2c86bf1 100644
> --- i/man3/printf.3
> +++ w/man3/printf.3
> @@ -409,8 +409,9 @@ Instead of a decimal digit string one may write
> "*" or "*mquot;
>  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 ,
> 
> 
> --
> Chris Hall
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux