diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-09-06 17:19:22 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-09-06 17:19:22 -0300 |
commit | ff9c0da7839543478d62306dd208f11caab130c1 (patch) | |
tree | c3a21468a889cd474bf695691834a128e79ef787 | |
parent | f7fe04d4b78fb4027c1c9960e1a1b4c778a1252f (diff) | |
download | lua-ff9c0da7839543478d62306dd208f11caab130c1.tar.gz lua-ff9c0da7839543478d62306dd208f11caab130c1.tar.bz2 lua-ff9c0da7839543478d62306dd208f11caab130c1.zip |
test first the most common case.
-rw-r--r-- | lobject.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 1.20 1999/08/16 20:52:00 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 1.21 1999/09/06 13:55:09 roberto Exp roberto $ |
3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -130,10 +130,10 @@ int luaO_str2d (const char *s, real *result) { /* LUA_NUMBER */ | |||
130 | } | 130 | } |
131 | while (isspace((unsigned char)*s)) s++; | 131 | while (isspace((unsigned char)*s)) s++; |
132 | if (*s != '\0') return 0; /* invalid trailing characters? */ | 132 | if (*s != '\0') return 0; /* invalid trailing characters? */ |
133 | if (point > 0) | 133 | if (point != 0) { |
134 | a /= expten(point); | 134 | if (point > 0) a /= expten(point); |
135 | else if (point < 0) | 135 | else a *= expten(-point); |
136 | a *= expten(-point); | 136 | } |
137 | *result = a; | 137 | *result = a; |
138 | return 1; | 138 | return 1; |
139 | } | 139 | } |