diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-04-13 16:28:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-04-13 16:28:49 -0300 |
commit | 0bbd96bd5f973f716a93a704e04cf1c78145795f (patch) | |
tree | c65fbfafcb43b4d4de8a592243d7955ce824073f /lobject.c | |
parent | 4eb67aa7107e495bc756f37b7dcc936ee113afd7 (diff) | |
download | lua-0bbd96bd5f973f716a93a704e04cf1c78145795f.tar.gz lua-0bbd96bd5f973f716a93a704e04cf1c78145795f.tar.bz2 lua-0bbd96bd5f973f716a93a704e04cf1c78145795f.zip |
details.
Diffstat (limited to 'lobject.c')
-rw-r--r-- | lobject.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 1.17 1999/02/12 19:23:02 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 1.18 1999/02/26 15:48:30 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 | */ |
@@ -93,25 +93,25 @@ static double expten (unsigned int e) { | |||
93 | double luaO_str2d (char *s) { /* LUA_NUMBER */ | 93 | double luaO_str2d (char *s) { /* LUA_NUMBER */ |
94 | double a = 0.0; | 94 | double a = 0.0; |
95 | int point = 0; | 95 | int point = 0; |
96 | if (!isdigit((unsigned char)*s) && !isdigit((unsigned char)*(s+1))) | ||
97 | return -1; /* no digit before or after decimal point */ | ||
98 | while (isdigit((unsigned char)*s)) { | 96 | while (isdigit((unsigned char)*s)) { |
99 | a = 10.0*a + (*(s++)-'0'); | 97 | a = 10.0*a + (*(s++)-'0'); |
100 | } | 98 | } |
101 | if (*s == '.') s++; | 99 | if (*s == '.') { |
102 | while (isdigit((unsigned char)*s)) { | 100 | s++; |
103 | a = 10.0*a + (*(s++)-'0'); | 101 | while (isdigit((unsigned char)*s)) { |
104 | point++; | 102 | a = 10.0*a + (*(s++)-'0'); |
103 | point++; | ||
104 | } | ||
105 | } | 105 | } |
106 | if (toupper((unsigned char)*s) == 'E') { | 106 | if (toupper((unsigned char)*s) == 'E') { |
107 | int e = 0; | 107 | int e = 0; |
108 | int sig = 1; | 108 | int sig = 1; |
109 | s++; | 109 | s++; |
110 | if (*s == '+') s++; | 110 | if (*s == '-') { |
111 | else if (*s == '-') { | ||
112 | s++; | 111 | s++; |
113 | sig = -1; | 112 | sig = -1; |
114 | } | 113 | } |
114 | else if (*s == '+') s++; | ||
115 | if (!isdigit((unsigned char)*s)) return -1; /* no digit in the exponent? */ | 115 | if (!isdigit((unsigned char)*s)) return -1; /* no digit in the exponent? */ |
116 | do { | 116 | do { |
117 | e = 10*e + (*(s++)-'0'); | 117 | e = 10*e + (*(s++)-'0'); |