|
Message-ID: <CAOH62Jggcu2Ej9-9djYaF3NEqXMfujBoPdPZM8VHhbBj7V=Y+g@mail.gmail.com>
Date: Tue, 8 Nov 2011 06:43:45 +0100
From: Pascal Cuoq <pascal.cuoq@...il.com>
To: musl@...ts.openwall.com
Subject: Re: Undefined behavior in atoi()
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.
> Glad to hear you found the code pleasant, at least that part. Some
> things (like floating point in vfprintf.c) are a bit ugly.. :)
>
I did look at the floating-point part in vfprintf.c, because of
the claim on musl's website that printing floating-point numbers
was correct. I have had trouble with floating-point
to decimal conversion too, but I cheated a little there by inventing
by own format:
http://blog.frama-c.com/index.php?post/2011/10/29/A-portable-OCaml-function-to-print-floats
Pascal
Content of type "text/html" skipped
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.