aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bignum.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bignum.c b/bignum.c
index 41b1043b99..bc283ac89a 100644
--- a/bignum.c
+++ b/bignum.c
@@ -6102,6 +6102,8 @@ big_fdiv(VALUE x, VALUE y, long ey)
l = BIGNUM_LEN(x);
ex = l * BITSPERDIG - nlz(BDIGITS(x)[l-1]);
ex -= 2 * DBL_BIGDIG * BITSPERDIG;
+ if (ex > BITSPERDIG) ex -= BITSPERDIG;
+ else if (ex > 0) ex = 0;
if (ex) x = big_shift(x, ex);
bigdivrem(x, y, &z, 0);