Re: df displays 0.

From: David Schultz <das_at_freebsd.org>
Date: Mon, 14 Apr 2003 04:49:13 -0700
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.)
Received on Mon Apr 14 2003 - 02:49:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:03 UTC