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
This commit is contained in:
shyouhei 2012-06-06 05:47:45 +00:00
parent 996e9cf4e9
commit 1acfb03370
4 changed files with 17 additions and 11 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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