diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-11 10:37:09 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-11 10:37:09 +0000 |
commit | 6c93dee7ed9eddf55431ae734502bad335f7e50a (patch) | |
tree | eee2ddb6d51f0f8bed81ac943b75f3cbe6c92cb0 /bignum.c | |
parent | b5154b0eb71f0b1c523a1361fff2221907c87fc5 (diff) |
merge revision(s) 57179:
bignum.c: precise fdiv
* bignum.c (big_fdiv): more precise calculation. [ruby-dev:49915]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -6101,6 +6101,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); |