From 85bcd2b35f7f5b5627c8a64381c1859037696ff9 Mon Sep 17 00:00:00 2001 From: mame Date: Wed, 4 Apr 2018 14:02:59 +0000 Subject: bignum.c: Bignum#fdiv avoids double division when divisor is bignum `Rational(int, bignum).to_f` sometimes returned a wrong result because `Bignum#div` casted its divisor to double. [Bug #14637] [ruby-core:86330] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bignum.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'bignum.c') diff --git a/bignum.c b/bignum.c index b4c7560034..fd5f385cac 100644 --- a/bignum.c +++ b/bignum.c @@ -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); -- cgit v1.2.3