From owner-freebsd-bugs Sun Aug 25 18:20: 8 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 702A037B400 for ; Sun, 25 Aug 2002 18:20:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2E50F43E65 for ; Sun, 25 Aug 2002 18:20:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7Q1K3JU017099 for ; Sun, 25 Aug 2002 18:20:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7Q1K3vf017098; Sun, 25 Aug 2002 18:20:03 -0700 (PDT) Date: Sun, 25 Aug 2002 18:20:03 -0700 (PDT) Message-Id: <200208260120.g7Q1K3vf017098@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: bin/41823: printf("%+f\n", -0.0) generates +0.000000 Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/41823; it has been noted by GNATS. From: Bruce Evans To: Jens Schweikhardt Cc: GNATS Bug Followup Subject: Re: bin/41823: printf("%+f\n", -0.0) generates +0.000000 Date: Mon, 26 Aug 2002 11:25:06 +1000 (EST) On Sun, 25 Aug 2002, Jens Schweikhardt wrote: > Ok, here's a patch you'll like -- it reduces the lines of code :-) > > Index: vfprintf.c > =================================================================== > RCS file: /home/ncvs/src/lib/libc/stdio/vfprintf.c,v > retrieving revision 1.43 > diff -u -r1.43 vfprintf.c > --- vfprintf.c 15 Aug 2002 10:28:52 -0000 1.43 > +++ vfprintf.c 25 Aug 2002 13:26:08 -0000 > @@ -1409,13 +1409,8 @@ > ndigits++; > mode = 2; /* ndigits significant digits */ > } > - if (value < 0) { > - value = -value; > - *sign = '-'; > - } else > - *sign = '\000'; > - digits = __dtoa(value, mode, ndigits, decpt, &dsgn, &rve, > - dtoaresultp); > + digits = __dtoa(value, mode, ndigits, decpt, &dsgn, &rve, dtoaresultp); > + *sign = dsgn != 0; > if ((ch != 'g' && ch != 'G') || flags & ALT) { > /* print trailing zeros */ > bp = digits + ndigits; > Yes, I like it. Assuming that it works of course. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message