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 | 390915616b29ae12c5247ec03fa1ba77e10ec928 (patch) | |
tree | 43a2d5a409497b86c50dbc005eddd5d810bd61b6 /util.c | |
parent | abd5da8f21a9f7ed7b10e1a637abe90a72b92db0 (diff) | |
download | ruby-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.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; } |