From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4801 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: printf issues Date: Fri, 4 Apr 2014 21:41:20 -0400 Message-ID: <20140405014120.GT26358@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 1396662101 23994 80.91.229.3 (5 Apr 2014 01:41:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Apr 2014 01:41:41 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4805-gllmg-musl=m.gmane.org@lists.openwall.com Sat Apr 05 03:41:34 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 1WWFby-0002NR-5D for gllmg-musl@plane.gmane.org; Sat, 05 Apr 2014 03:41:34 +0200 Original-Received: (qmail 17488 invoked by uid 550); 5 Apr 2014 01:41:33 -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 17477 invoked from network); 5 Apr 2014 01:41:33 -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:4801 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. This looks right. Are you sure a==big is not possible at this point? I *think* it's impossible, since a==big can only happen if e2<0, in which case applying the exponent is going to reduce the first slot so that rounding could never cause it to overflow. Do you agree with this analysis? Rich