summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/util.c b/util.c
index c2c1929bc3..d8247df1b6 100644
--- a/util.c
+++ b/util.c
@@ -863,9 +863,15 @@ ruby_strtod(string, endPtr)
}
expSign = FALSE;
}
- while (ISDIGIT(*p)) {
- exp = exp * 10 + (*p - '0');
- p += 1;
+ if (ISDIGIT(*p)) {
+ do {
+ exp = exp * 10 + (*p - '0');
+ p += 1;
+ }
+ while (ISDIGIT(*p));
+ }
+ else {
+ p = pExp;
}
}
if (expSign) {