[gambit-list] Another patch for naive-div
feeley at iro.umontreal.ca
Tue Oct 22 10:48:58 EDT 2013
On 2013-10-21, at 4:55 PM, Bradley Lucier <lucier at math.purdue.edu> wrote:
> This patch estimates the size of the quotient much more carefully (at the bit level); it also starts the computation with the first possible nonzero mdigit of the quotient. So it's faster in the very important case of small (but still bignum) dividend and divisor.
Have you measured how much faster?
> And it's much simpler to understand than the old code.
> Passes 32-bit and 64-bit "make check". I don't have a machine that I can configure with 32-bit adigits and 16-bit mdigits (i.e., no "long long").
It also passes "make check" here, so I have committed your patch to the repo.
I wish there was a more substantial suite of unit tests, particularly for the numerical lib which has several intricate algorithms. There are some unit tests in tests/error.scm but they don't cover every function and special case. Would you be willing to create a unit test suite for the numerical lib which tests each function individually, and all the corner cases?
I have started the development of a unit test suite for the Gambit compiler backends. It is a bunch of small Scheme files testing individual primitive functions. Perhaps that can be a source of inspiration. You can try it like this:
Of course, I invite everyone to pitch in to build the test suite.
More information about the Gambit-list