develooper Front page | perl.perl5.porters | Postings from December 2013

Re: [perl #120426] Strange and unwarranted underflow in string-to-number

Thread Previous
From:
Karl Williamson
Date:
December 4, 2013 17:40
Subject:
Re: [perl #120426] Strange and unwarranted underflow in string-to-number
Message ID:
529F68FF.40200@khwilliamson.com
On 12/04/2013 10:22 AM, Dave Mitchell wrote:
> On Tue, Dec 03, 2013 at 01:21:53PM -0500, Morten Welinder wrote:
>> If I understand you right, you are rolling your own atof.
>
> Yep.
>
>> That is tricky business.
>
> Yep.
>
>> There are some tricky cases at
>>
>>      http://www.exploringbinary.com/incorrectly-rounded-conversions-in-gcc-and-glibc/
>>
>> that glibc has only recently gotten right.
>
> Thanks.
>
> Does anyone know why we roll our own?
>
There is a comment in sv.c

/* This is evil, but floating point is even more evil */

It may be because we found plenty of bugs in vendor libc's and thought 
we could do a better job.  Also is the issue of locales.  (That's why we 
shouldn't be using atoi()).

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About