ruby-changes:23890
From: shyouhei <ko1@a...>
Date: Wed, 6 Jun 2012 14:47:56 +0900 (JST)
Subject: [ruby-changes:23890] shyouhei:r35941 (ruby_1_8_7): merge revision(s) 28324:
shyouhei 2012-06-06 14:47:45 +0900 (Wed, 06 Jun 2012) New Revision: 35941 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35941 Log: 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] Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/bignum.c branches/ruby_1_8_7/test/ruby/test_bignum.rb branches/ruby_1_8_7/version.h Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 35940) +++ ruby_1_8_7/ChangeLog (revision 35941) @@ -1,3 +1,9 @@ +Wed Jun 6 14:44:13 2012 Kenta Murata <mrkn@m...> + + * 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@f...> * lib/webrick/utils.rb: fix fcntl call. @@ -21,15 +27,6 @@ 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@r...> - - * 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@r...> * marshal.c (mark_dump_arg): mark destination string. patch by Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 35940) +++ ruby_1_8_7/version.h (revision 35941) @@ -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 Index: ruby_1_8_7/bignum.c =================================================================== --- ruby_1_8_7/bignum.c (revision 35940) +++ ruby_1_8_7/bignum.c (revision 35941) @@ -1069,7 +1069,10 @@ 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; } Index: ruby_1_8_7/test/ruby/test_bignum.rb =================================================================== --- ruby_1_8_7/test/ruby/test_bignum.rb (revision 35940) +++ ruby_1_8_7/test/ruby/test_bignum.rb (revision 35941) @@ -103,4 +103,10 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/