1
0
mirror of https://github.com/lua/lua.git synced 2025-01-28 06:03:00 +08:00

test first the most common case.

This commit is contained in:
Roberto Ierusalimschy 1999-09-06 17:19:22 -03:00
parent f7fe04d4b7
commit ff9c0da783

View File

@ -1,5 +1,5 @@
/*
** $Id: lobject.c,v 1.20 1999/08/16 20:52:00 roberto Exp roberto $
** $Id: lobject.c,v 1.21 1999/09/06 13:55:09 roberto Exp roberto $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@ -130,10 +130,10 @@ int luaO_str2d (const char *s, real *result) { /* LUA_NUMBER */
}
while (isspace((unsigned char)*s)) s++;
if (*s != '\0') return 0; /* invalid trailing characters? */
if (point > 0)
a /= expten(point);
else if (point < 0)
a *= expten(-point);
if (point != 0) {
if (point > 0) a /= expten(point);
else a *= expten(-point);
}
*result = a;
return 1;
}