• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2                            C++ Big Integer Library
3                          (see ChangeLog for version)
4
5                        http://mattmccutchen.net/bigint/
6
7       Written and maintained by Matt McCutchen <matt@mattmccutchen.net>
8
9You can use this library in a C++ program to do arithmetic on integers of size
10limited only by your computer's memory.  The library provides BigUnsigned and
11BigInteger classes that represent nonnegative integers and signed integers,
12respectively.  Most of the C++ arithmetic operators are overloaded for these
13classes, so big-integer calculations are as easy as:
14
15    #include "BigIntegerLibrary.hh"
16
17    BigInteger a = 65536;
18    cout << (a * a * a * a * a * a * a * a);
19
20    (prints 340282366920938463463374607431768211456)
21
22The code in `sample.cc' demonstrates the most important features of the library.
23To get started quickly, read the code and explanations in that file and run it.
24If you want more detail or a feature not shown in `sample.cc', consult the
25consult the actual header and source files, which are thoroughly commented.
26
27This library emphasizes ease of use and clarity of implementation over speed;
28some users will prefer GMP (http://swox.com/gmp/), which is faster.  The code is
29intended to be reasonably portable across computers and modern C++ compilers; in
30particular, it uses whatever word size the computer provides (32-bit, 64-bit, or
31otherwise).
32
33Compiling programs that use the library
34---------------------------------------
35The library consists of a folder full of C++ header files (`.hh') and source
36files (`.cc').  Your own programs should `#include' the necessary header files
37and link with the source files.  A makefile that builds the sample program
38(`sample.cc') is included; you can adapt it to replace the sample with your own
39program.
40
41Alternatively, you can use your own build system or IDE.  In that case, you must
42put the library header files where the compiler will find them and arrange to
43have your program linked with the library source files; otherwise, you will get
44errors about missing header files or "undefined references".  To learn how to do
45this, consult the documentation for the build system or IDE; don't bother asking
46me.  Adding all the library files to your project will work in many IDEs but may
47not be the most desirable approach.
48
49Resources
50---------
51The library's Web site (above) provides links to released versions, the current
52development version, and a mailing list for release announcements, questions,
53bug reports, and other discussion of the library.  I would be delighted to hear
54from you if you like this library and/or find a good use for it.
55
56Bugs and enhancements
57---------------------
58The library has been tested by me and others but is by no means bug-free.  If
59you find a bug, please report it, whether it comes in the form of compiling
60trouble, a mathematically inaccurate result, or a memory-management blooper
61(since I use Java, these are altogether too common in my C++).  I generally fix
62all reported bugs.  You are also welcome to request enhancements, but I am
63unlikely to do substantial amounts of work on enhancements at this point.
64
65Legal
66-----
67I, Matt McCutchen, the sole author of the original Big Integer Library, waive my
68copyright to it, placing it in the public domain.  The library comes with
69absolutely no warranty.
70
71~~~~
72