diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-18 01:55:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-18 01:55:15 +0000 |
commit | 4a1513e2fb71b3fe8a67fdde3189e3857daa855d (patch) | |
tree | 43a2d5a409497b86c50dbc005eddd5d810bd61b6 /util.c | |
parent | 575f1320d419d53c43eb4e0b7e52cfb674fcdadb (diff) | |
download | ruby-4a1513e2fb71b3fe8a67fdde3189e3857daa855d.tar.gz |
* 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/trunk@10553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; } |