[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LUA4.0 : Bug with maths (constructive)
- From: "paulmatthews" <paulmatthews@...>
- Date: Mon, 11 Feb 2002 22:31:58 -0000
If I'm going to give code examples I better make sure they work :-)
double tonumber( const char *str )
{
double result;
char *endptr = (char*)str;
if( str != NULL ) {
errno=0;
result = strtod( str, &endptr );
}
if( endptr == str )
errno = EINVAL;
if( errno != 0 && errno != ERANGE ) {
perror( "tonumber()" );
exit(errno);
}
return result;
}