df displays 0.
David Schultz
das at freebsd.org
Mon Apr 14 04:49:17 PDT 2003
On Mon, Apr 14, 2003, Andrey A. Chernov wrote:
> On Mon, Apr 14, 2003 at 14:11:52 +0400, Andrey A. Chernov wrote:
> > On Mon, Apr 14, 2003 at 12:05:16 +0200, Christoph Kukulies wrote:
> >
> > > /dev/ad0s1e 257838 22 237190 0.% /tmp
> >
> > Looks like new printf error.
>
> Test program:
>
> main() {
> (void)printf(" %5.0f%%\n", (double)0.1);
> }
I just took care of this. The problem arises from a slight
inconsistency[1] in dtoa's handling of a precision of 0 (and a
corresponding bug in my code). Specifically, if you tell it to
print 0.0 or any number >0.5 and <10 using precision 0 in the
mode used for %f, it will tell you that the decimal point comes
after the first digit by setting expt to 1. But for numbers >0
and <=0.5, it sets expt to 0 instead. (I think the rationale is
that in the latter cases, the leading digit isn't significant.)
More information about the freebsd-current
mailing list