ruby-changes:45106
From: nobu <ko1@a...>
Date: Sun, 25 Dec 2016 17:47:26 +0900 (JST)
Subject: [ruby-changes:45106] nobu:r57179 (trunk): bignum.c: precise fdiv
nobu 2016-12-25 17:47:22 +0900 (Sun, 25 Dec 2016) New Revision: 57179 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57179 Log: bignum.c: precise fdiv * bignum.c (big_fdiv): more precise calculation. [ruby-dev:49915] Modified files: trunk/bignum.c Index: bignum.c =================================================================== --- bignum.c (revision 57178) +++ bignum.c (revision 57179) @@ -6102,6 +6102,8 @@ big_fdiv(VALUE x, VALUE y, long ey) https://github.com/ruby/ruby/blob/trunk/bignum.c#L6102 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/