diff options
-rw-r--r-- | bignum.c | 4 | ||||
-rw-r--r-- | test/ruby/test_rational.rb | 1 |
2 files changed, 2 insertions, 3 deletions
@@ -6178,9 +6178,7 @@ rb_big_fdiv_double(VALUE x, VALUE y) return big_fdiv_int(x, rb_int2big(FIX2LONG(y))); } else if (RB_BIGNUM_TYPE_P(y)) { - dy = rb_big2dbl(y); - if (isinf(dx) || isinf(dy)) - return big_fdiv_int(x, y); + return big_fdiv_int(x, y); } else if (RB_FLOAT_TYPE_P(y)) { dy = RFLOAT_VALUE(y); diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb index ae253d89fc..c44ff0393a 100644 --- a/test/ruby/test_rational.rb +++ b/test/ruby/test_rational.rb @@ -837,6 +837,7 @@ class Rational_Test < Test::Unit::TestCase def test_to_f assert_equal(1.5, Rational(3,2).to_f) assert_equal(1.5, Float(Rational(3,2))) + assert_equal(1e-23, Rational(1, 10**23).to_f, "Bug #14637") end def test_to_c |