Date: Mon, 14 Apr 2003 04:49:13 -0700 From: David Schultz <das@freebsd.org> To: "Andrey A. Chernov" <ache@nagual.pp.ru> Cc: freebsd-current@freebsd.org Subject: Re: df displays 0. Message-ID: <20030414114913.GC18110@HAL9000.homeunix.com> In-Reply-To: <20030414102446.GA37148@nagual.pp.ru> References: <200304141005.h3EA5GM01835@accms33.physik.rwth-aachen.de> <20030414101152.GA29163@nagual.pp.ru> <20030414102446.GA37148@nagual.pp.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
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.)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030414114913.GC18110>
