lua-users home
lua-l archive

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


--- In lua-l@y..., Luiz Henrique de Figueiredo <lhf@t...> wrote:
> It seems that your atof accepts "NAN" and returns IEEE NaN.
> In general, atof is not required by ANSI C to do so and 
> will return 0 instead, which is what it does in my Linux.
> --lhf

Hate to ask what linux are you running! Mine (intel) accepts and 
handles NaN properly, infact all linux installs I've had have handled 
NaN properly, the Solaris machies here at work all accept and 
handle "NaN" properly. If your machine does not handle NaN suggest 
you better get a new one! Gosh how can you do any serious maths work 
without everyones friends +INF, -INF and NAN popping up in your face!!

At ant rate I would hope that if lua runs on any machine that handles 
NaN, then lua it should handle NaN. Don't have access to the ANSI C / 
POSIX atof() or strtod() spec. Do you have the relevant reference. 
The man pages all talk about NAN.

Even so, isn't this a minimum worst case spec for atof(). Granted not 
all platforms have hardware NaN support. But most do. tonumber() 
should handle "NaN".

--
Paul Matthews