diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-25 08:47:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-25 08:47:22 +0000 |
commit | c6eb59c439cf8b6375a2aba18265a06405a5c651 (patch) | |
tree | a75620e9800917a0c5fc9183d6f3fbc186dd533b /bignum.c | |
parent | 6335fc6fe31b7c8f20b398a8618d208c72950f94 (diff) |
bignum.c: precise fdiv
* bignum.c (big_fdiv): more precise calculation. [ruby-dev:49915]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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); |