lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Tuesday, December 6, 2005, 5:02:24 PM, Glenn Maynard wrote:

> On Mon, Dec 05, 2005 at 01:30:38PM -0500, John Passaniti wrote:
>> Antero Vipunen wrote:
>> >Lua lexer treats dot `.' as separator. But relies (by default) on 
>> >strtod() for converting, and thus if your ``local'' separator is `,',
>> >you are unable to compile the following sample program:

> I can think of four solutions, and they're all ugly:

> #1: Lua rolls its own conversion.  Bloats the code, but can be omitted
>     on embedded platforms where strtod() will do what's expected.

Ugh! strtod() is extremely hard to get right. It is right in glibc
because it is based on David Gay's code. Unless you have a very high
quality implementation, don't do it!

See:
http://portal.acm.org/citation.cfm?id=93557
http://portal.acm.org/citation.cfm?id=989431

Implementations:
http://www.netlib.org/fp/dtoa.c
http://www.netlib.org/fp/gdtoa.tgz
http://netlib.bell-labs.com/netlib/fp/

e

-- 
Doug Currie
Londonderry, NH