From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4821 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: printf issues Date: Mon, 7 Apr 2014 03:29:30 -0400 Message-ID: <20140407072930.GB26358@brightrain.aerifal.cx> References: <20140404141515.GD3034@port70.net> <20140404150705.GN26358@brightrain.aerifal.cx> <20140404185413.GH3034@port70.net> <20140404210837.GS26358@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1396855795 4830 80.91.229.3 (7 Apr 2014 07:29:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Apr 2014 07:29:55 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4825-gllmg-musl=m.gmane.org@lists.openwall.com Mon Apr 07 09:29:47 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WX401-0006Ia-Ez for gllmg-musl@plane.gmane.org; Mon, 07 Apr 2014 09:29:45 +0200 Original-Received: (qmail 13799 invoked by uid 550); 7 Apr 2014 07:29:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 13790 invoked from network); 7 Apr 2014 07:29:43 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4821 Archived-At: On Fri, Apr 04, 2014 at 08:01:00PM -0400, Morten Welinder wrote: > I *think* the right fix is to add the following "if' statement into > the rounding loop: > > while (*d > 999999999) { > *d--=0; > if (d < a) *--a = 0; > (*d)++; > } > > This also ought to make the d more tests would be better. After re-studying the code, I think this is the correct fix, and I've committed the fix to git. I also fixed the bug where %g failed to trim trailing zeros. Rich