Improved testing of an arbitrary-precision arithmetic library using artificially small words

Bachelor's thesis in computer science at Stockholm University by Per Olofsson.

Abstract

The GNU Multiple Precision Arithmetic Library (GMP) is a software library for making arithmetic computations with numbers of arbitrary size (so-called bignums). GMP is free software and is used by many popular software packages such as Sage, Mathematica, Wolfram Alpha, Maple, and GCC. GMP also includes a comprehensive test suite.

GMP works by splitting large numbers into small pieces (called limbs), where each piece is stored as a full native computer word. We have modified GMP to be able to split numbers into much smaller pieces as a compilation-time option, by using the operator overloading feature of the C++ programming language. The purpose is to make the test suite more effective, increasing the probability of finding potential errors.

The result has been improved source code quality in GMP, as well as the elimination of some errors. The source code modifications done during this project will be included in future releases of GMP, and will be used to test new code.

Full text (pdf)

Code

The code developed during the project can be found in my Mercurial repository. Get it with:

hg clone http://people.dsv.su.se/~pelle/hg/gmp\#alimbs gmp-alimbs

(The '#' character is used to get a named branch.)