summaryrefslogtreecommitdiffstats
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
commit390915616b29ae12c5247ec03fa1ba77e10ec928 (patch)
tree43a2d5a409497b86c50dbc005eddd5d810bd61b6 /util.c
parentabd5da8f21a9f7ed7b10e1a637abe90a72b92db0 (diff)
downloadruby-390915616b29ae12c5247ec03fa1ba77e10ec928.tar.gz
ruby-390915616b29ae12c5247ec03fa1ba77e10ec928.tar.xz
ruby-390915616b29ae12c5247ec03fa1ba77e10ec928.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@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 867b14c4b..3f85c5b13 100644
--- a/util.c
+++ b/util.c
@@ -874,11 +874,13 @@ ruby_strtod(
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;
@@ -924,6 +926,7 @@ ruby_strtod(
fraction = frac1 + frac2;
}
+ ret:
if (endPtr != NULL) {
*endPtr = (char *)p;
}