Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111108141216.GQ132@brightrain.aerifal.cx>
Date: Tue, 8 Nov 2011 09:12:16 -0500
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: Undefined behavior in atoi()

On Tue, Nov 08, 2011 at 06:43:45AM +0100, Pascal Cuoq wrote:
> On Tue, Nov 8, 2011 at 4:44 AM, Rich Felker <dalias@...ifal.cx> wrote:
> 
> > On Sun, Nov 06, 2011 at 11:28:41PM +0100, Pascal Cuoq wrote:
> >
> > > I was looking at implementations for strtod() (long story for another
> > time)
> >
> > It should be noted that the current implementation is not correct.
> > There's lots of loss-of-precision.
> >
> 
> So I have seen, but if it's possible to do better for the objectives of
> musl,
> I do not know how. David M. Gay's code is efficient but it's not portable,
> and the other implementation I found (provided as part of Tcl and Ruby
> for instance) is only to a few ULPs too.
> 
> I am going to write my own, with multi-precision integers (that I already
> rely on for other things). I am hoping that by letting ldexp take care
> of denormals and infinites, it will be simple.

I believe it's possible using a method similar to what's in
vfprintf.c, but in reverse. In principle this amounts to using
high-precision floats, but with only a couple operations permitted on
them and fixed-size buffers, the code simplifies down to a managable
level. Actually that's why mentioning it came to mind..

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.