Skip to content

Commit 1acfb03

Browse files
committed
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 ruby#3362] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@35941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 996e9cf commit 1acfb03

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

ChangeLog

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Wed Jun 6 14:44:13 2012 Kenta Murata <mrkn@mrkn.jp>
2+
3+
* bignum.c (rb_big2dbl), test/ruby/test_bignum.rb (test_to_f):
4+
A negative Bignum out of Float range should be converted to -Infinity.
5+
[ruby-core:30492] [Bug #3362]
6+
17
Wed Jun 6 14:06:02 2012 Tanaka Akira <akr@fsij.org>
28

39
* lib/webrick/utils.rb: fix fcntl call.
@@ -21,15 +27,6 @@ Sat Apr 14 18:51:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
2127
GC. [exerb-dev:0578]. patched by MURASE Masamitsu
2228
<masamitsu.murase AT gmail.com> at [exerb-dev:0580]
2329

24-
Tue Mar 6 12:05:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
25-
26-
* lib/yaml/rubytypes.rb (Exception.yaml_new): fix bug that causes
27-
YAML serialization problem for Exception.
28-
Exception#initialize doesn't use visible instance variable for
29-
the exception message, so call the method with the message.
30-
patched by Jingwen Owen Ou <jingweno AT gmail.com>.
31-
http://github.com/ruby/ruby/pull/41
32-
3330
Fri Mar 2 11:44:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
3431

3532
* marshal.c (mark_dump_arg): mark destination string. patch by

bignum.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,10 @@ rb_big2dbl(x)
10691069

10701070
if (isinf(d)) {
10711071
rb_warn("Bignum out of Float range");
1072-
d = HUGE_VAL;
1072+
if (d < 0.0)
1073+
d = -HUGE_VAL;
1074+
else
1075+
d = HUGE_VAL;
10731076
}
10741077
return d;
10751078
}

test/ruby/test_bignum.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,10 @@ def test_too_big_to_s
103103
e = assert_raise(RangeError) {(1 << big).to_s}
104104
assert_match(/too big to convert/, e.message)
105105
end
106+
107+
def test_to_f
108+
inf = 1 / 0.0
109+
assert_equal(inf, (1 << 65536).to_f)
110+
assert_equal(-inf, (-1 << 65536).to_f) # [ruby-core:30492] [Bug #3362]
111+
end
106112
end

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define RUBY_RELEASE_DATE "2012-06-06"
33
#define RUBY_VERSION_CODE 187
44
#define RUBY_RELEASE_CODE 20120606
5-
#define RUBY_PATCHLEVEL 364
5+
#define RUBY_PATCHLEVEL 365
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8

0 commit comments

Comments
 (0)