summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-18 01:55:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-18 01:55:15 +0000
commit7b0c9cf2e2a5e8a084d122e3432457c324a7bd89 (patch)
tree48d8436380c4f99d5301e0104745e411ae4c25b9 /util.c
parent1c08471a41c9569f7370a08cc6ce7de9f3510dd0 (diff)
* object.c (rb_cstr_to_dbl): limit out-of-range message.
* util.c (ruby_strtod): return end pointer even if ERANGE occurred. fixed: [ruby-dev:29041] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r--util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/util.c b/util.c
index 6c18543..76902d9 100644
--- a/util.c
+++ b/util.c
@@ -890,11 +890,13 @@ ruby_strtod(string, endPtr)
if (exp >= MDMAXEXPT) {
errno = ERANGE;
- return HUGE_VAL * (sign ? -1.0 : 1.0);
+ fraction = HUGE_VAL;
+ goto ret;
}
else if (exp < MDMINEXPT) {
errno = ERANGE;
- return 0.0 * (sign ? -1.0 : 1.0);
+ fraction = 0.0;
+ goto ret;
}
fracExp = exp;
exp += 9;
@@ -940,6 +942,7 @@ ruby_strtod(string, endPtr)
fraction = frac1 + frac2;
}
+ ret:
if (endPtr != NULL) {
*endPtr = (char *)p;
}