summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-11 13:03:46 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-11 13:03:46 +0000
commitea52cac1487cea91a148daffbfe0dacef672051b (patch)
tree4a223af18f6b18978aedda2c11bfe771254a990e /test
parent2f1cc54d5fd9078c90ad240fce4f132feb1eaffe (diff)
merge revision(s) 57227: [Backport #13078]
numeric.c: reduce fdiv * numeric.c (rb_int_fdiv_double): reduce first for more precise result. [ruby-core:78886] [Bug #13078] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_rational.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb
index 99f80bc561..9651f46f01 100644
--- a/test/ruby/test_rational.rb
+++ b/test/ruby/test_rational.rb
@@ -905,6 +905,13 @@ class Rational_Test < Test::Unit::TestCase
assert_equal(5000000000.0, 10000000000.fdiv(2))
assert_equal(0.5, 1.0.fdiv(2))
assert_equal(0.25, Rational(1,2).fdiv(2))
+
+ a = 0xa42fcabf_c51ce400_00001000_00000000_00000000_00000000_00000000_00000000
+ b = 1<<1074
+ assert_equal(Rational(a, b).to_f, a.fdiv(b))
+ a = 3
+ b = 0x20_0000_0000_0001
+ assert_equal(Rational(a, b).to_f, a.fdiv(b))
end
def test_ruby19