From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/698 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: float scanner status, upcoming release Date: Mon, 9 Apr 2012 20:36:56 -0400 Message-ID: <20120410003656.GA7281@brightrain.aerifal.cx> References: <20120409191712.GA5269@brightrain.aerifal.cx> <20120409192149.GH8803@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: dough.gmane.org 1334018111 15230 80.91.229.3 (10 Apr 2012 00:35:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 10 Apr 2012 00:35:11 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-699-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 10 02:35:10 2012 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 1SHP33-0004y5-Gc for gllmg-musl@plane.gmane.org; Tue, 10 Apr 2012 02:35:05 +0200 Original-Received: (qmail 26348 invoked by uid 550); 10 Apr 2012 00:35:05 -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 26338 invoked from network); 10 Apr 2012 00:35:04 -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:698 Archived-At: On Tue, Apr 10, 2012 at 02:09:23AM +0200, Pascal Cuoq wrote: > On Mon, Apr 9, 2012 at 9:21 PM, Rich Felker wrote: > > And here's the current code (standalone test program) if anybody wants > > to play with it or point out how much single-letter variable names > > suck or whatnot.. :-) > > Line 72: > > x[k] = x[k]*10 + c-'0'; > > I don't understand why this read access to x[k] is initialized. > If I change the declaration of local array x[] as: You're completely right and I was just getting lucky (and being too lazy to add the right warning options to my command line). x[0] should be set to 0 before the loop, and when k advances, the new x[k] should be set to 0. (Or we could pre-fill the whole array, but that's a huge cache-thrashing waste if the number to be read is small.) I'll send a new version of the code to the list shortly; it's very close to what I intend to commit for use with strtod, etc. Note that nsz has found another problem where extremely small values (smallest subnormal range) don't seem to be getting rounded correctly, so this and other issues need to be fixed before it goes into major production use. Still, I think the overall concept is sound... Rich