Matt McCutchen's Web SiteC++ Big Integer Library  (Top, Current issues, Resources, Bugs and enhancements, Legal, Bottom).  Email me about this page.

C++ Big Integer Library

Status: I have lost interest in maintaining this library and will not respond to most development or support inquiries.  As of 2014-10-18, I have lost the mailing list configuration and subscriber database due to a server failure and am taking the opportunity to shut the list down; the public archive remains available for now.  I want to apologize to anyone who may have wasted effort as a result of my waiting so long to announce this situation.

You can use this library in a C++ program to do arithmetic on integers of size limited only by your computer's memory.  The library provides BigUnsigned and BigInteger classes that represent nonnegative integers and signed integers, respectively.  Most of the C++ arithmetic operators are overloaded for these classes, so big-integer calculations are as easy as:

    #include "BigIntegerLibrary.hh"
    BigInteger a = 65536;
    cout << (a * a * a * a * a * a * a * a);
    (prints 340282366920938463463374607431768211456)

The code in demonstrates the most important features of the library. To get started quickly, read the code and explanations in that file and run it. If you want more detail or a feature not shown in, consult the consult the actual header and source files, which are thoroughly commented.

This library emphasizes ease of use and clarity of implementation over speed; some users will prefer GMP, which is faster.  The code is intended to be reasonably portable across computers and modern C++ compilers; in particular, it uses whatever word size the computer provides (32-bit, 64-bit, or otherwise).

Current issues


Here is the library's source repository (using git version control) and a mirror that supports git:// access.

Released versions of the library (please see the ChangeLog for the differences between versions):

FileSizeModification time
bigint-2010.04.30.tar.bz2276732010-04-30 21:37:03 +0000
bigint-2010.04.30.zip399972010-04-30 21:37:03 +0000
bigint-2009.05.03.tar.bz2275292009-05-03 20:55:26 +0000
bigint-2009.05.03.zip398572009-05-03 20:55:26 +0000

New on 2008-01-30, changed on 2008-03-20!  I announce releases of the library on its Mailman list,  You can ask questions, report bugs, and otherwise discuss the library on this list.  Here is the list info page.  I would be delighted to hear from you if you like this library and/or find a good use for it. See the notice at the top.

NOTE: It is generally useless to ask me how to set up the library in your IDE because you know more about the IDE than I do (unless it's the Eclipse CDT).

Bugs and enhancements

The library has been tested by me and others but is by no means bug-free.  If you find a bug, please report it, whether it comes in the form of compiling trouble, a mathematically inaccurate result, or a memory-management blooper (since I use Java, these are altogether too common in my C++).  I generally fix all reported bugs.  You are also welcome to request enhancements, but I am unlikely to do substantial amounts of work on enhancements at this point.

I, Matt McCutchen, the sole author of the original Big Integer Library, waive my copyright to it, placing it in the public domain.  The library comes with absolutely no warranty.

Matt McCutchen's Web SiteC++ Big Integer Library  (Top, Current issues, Resources, Bugs and enhancements, Legal, Bottom).  Email me about this page.
Modification time of this page's main source file: 2014-10-18 16:44:19 +0000
Except where otherwise noted, Matt McCutchen waives his copyright to the content of this site.  This site comes with absolutely no warranty.  Why?