On Jun 26, 2013, at 9:37 AM, Joe Darcy wrote:

> Specifically, I was referred to how C handles "%0.4f\n".

On 6/24/2013 12:56 PM, Brian Burkhalter wrote:
> 
> By way of comparison, this C code
> 
>     printf("%1.4f\n", 56789.456789F);
>     printf("%0.4f\n", 56789.456789F);
> 
> prints this output
> 
> 56789.4570
> 56789.4570
   ^ ^ ^ ^ ^ ^ ^ ^
Like this.

It looks like it interprets the "0" as zero width, ignoring it as a flag. This 
appears contrary to the description of width in [1]:

"A leading zero in the width value is interpreted as the zero-padding flag 
mentioned above […]."

Thanks,

Brian

[1] https://en.wikipedia.org/wiki/Printf#Format_placeholders

Reply via email to