From owner-freebsd-current@FreeBSD.ORG Mon Apr 14 04:49:17 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 14EE037B401 for ; Mon, 14 Apr 2003 04:49:17 -0700 (PDT) Received: from HAL9000.homeunix.com (12-233-57-131.client.attbi.com [12.233.57.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6996843FD7 for ; Mon, 14 Apr 2003 04:49:16 -0700 (PDT) (envelope-from das@freebsd.org) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.9/8.12.5) with ESMTP id h3EBnDN7019157; Mon, 14 Apr 2003 04:49:13 -0700 (PDT) (envelope-from das@freebsd.org) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.9/8.12.5/Submit) id h3EBnDMs019156; Mon, 14 Apr 2003 04:49:13 -0700 (PDT) (envelope-from das@freebsd.org) Date: Mon, 14 Apr 2003 04:49:13 -0700 From: David Schultz To: "Andrey A. Chernov" Message-ID: <20030414114913.GC18110@HAL9000.homeunix.com> Mail-Followup-To: "Andrey A. Chernov" , Christoph Kukulies , freebsd-current@freebsd.org References: <200304141005.h3EA5GM01835@accms33.physik.rwth-aachen.de> <20030414101152.GA29163@nagual.pp.ru> <20030414102446.GA37148@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030414102446.GA37148@nagual.pp.ru> cc: Christoph Kukulies cc: freebsd-current@freebsd.org Subject: Re: df displays 0. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Apr 2003 11:49:17 -0000 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.)