diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-06 05:47:45 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-06 05:47:45 +0000 |
commit | 1acfb03370704aee624b7a1e5ccf4776f40f2895 (patch) | |
tree | e213362ebb3e05b012f699f215a2c4795ce9ecd3 | |
parent | 996e9cf4e9c78c4bf8fdbf937f3984e0b2eb6e40 (diff) |
merge revision(s) 28324:
* bignum.c (rb_big2dbl), test/ruby/test_bignum.rb (test_to_f):
A negative Bignum out of Float range should be converted to -Infinity.
[ruby-core:30492] [Bug #3362]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@35941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | bignum.c | 5 | ||||
-rw-r--r-- | test/ruby/test_bignum.rb | 6 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 17 insertions, 11 deletions
@@ -1,3 +1,9 @@ +Wed Jun 6 14:44:13 2012 Kenta Murata <mrkn@mrkn.jp> + + * bignum.c (rb_big2dbl), test/ruby/test_bignum.rb (test_to_f): + A negative Bignum out of Float range should be converted to -Infinity. + [ruby-core:30492] [Bug #3362] + Wed Jun 6 14:06:02 2012 Tanaka Akira <akr@fsij.org> * lib/webrick/utils.rb: fix fcntl call. @@ -21,15 +27,6 @@ Sat Apr 14 18:51:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> GC. [exerb-dev:0578]. patched by MURASE Masamitsu <masamitsu.murase AT gmail.com> at [exerb-dev:0580] -Tue Mar 6 12:05:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> - - * lib/yaml/rubytypes.rb (Exception.yaml_new): fix bug that causes - YAML serialization problem for Exception. - Exception#initialize doesn't use visible instance variable for - the exception message, so call the method with the message. - patched by Jingwen Owen Ou <jingweno AT gmail.com>. - http://github.com/ruby/ruby/pull/41 - Fri Mar 2 11:44:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> * marshal.c (mark_dump_arg): mark destination string. patch by @@ -1069,7 +1069,10 @@ rb_big2dbl(x) if (isinf(d)) { rb_warn("Bignum out of Float range"); - d = HUGE_VAL; + if (d < 0.0) + d = -HUGE_VAL; + else + d = HUGE_VAL; } return d; } diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb index 99c5952173..a0405ca274 100644 --- a/test/ruby/test_bignum.rb +++ b/test/ruby/test_bignum.rb @@ -103,4 +103,10 @@ class TestBignum < Test::Unit::TestCase e = assert_raise(RangeError) {(1 << big).to_s} assert_match(/too big to convert/, e.message) end + + def test_to_f + inf = 1 / 0.0 + assert_equal(inf, (1 << 65536).to_f) + assert_equal(-inf, (-1 << 65536).to_f) # [ruby-core:30492] [Bug #3362] + end end @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2012-06-06" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20120606 -#define RUBY_PATCHLEVEL 364 +#define RUBY_PATCHLEVEL 365 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 |