Commit | Line | Data |
---|---|---|
00c6448a MM |
1 | |
2 | C++ Big Integer Library | |
3 | (see ChangeLog for version) | |
4 | ||
3e132790 | 5 | http://mattmccutchen.net/bigint/ |
00c6448a | 6 | |
3e132790 | 7 | Written and maintained by Matt McCutchen <matt@mattmccutchen.net> |
00c6448a MM |
8 | |
9 | You can use this library in a C++ program to do arithmetic on integers of size | |
10 | limited only by your computer's memory. The library provides BigUnsigned and | |
11 | BigInteger classes that represent nonnegative integers and signed integers, | |
12 | respectively. Most of the C++ arithmetic operators are overloaded for these | |
13 | classes, 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 | ||
22 | The code in `sample.cc' demonstrates the most important features of the library. | |
23 | To get started quickly, read the code and explanations in that file and run it. | |
24 | If you want more detail or a feature not shown in `sample.cc', consult the | |
2531c4e3 | 25 | consult the actual header and source files, which are thoroughly commented. |
00c6448a | 26 | |
2531c4e3 MM |
27 | This library emphasizes ease of use and clarity of implementation over speed; |
28 | some users will prefer GMP (http://swox.com/gmp/), which is faster. The code is | |
29 | intended to be reasonably portable across computers and modern C++ compilers; in | |
30 | particular, it uses whatever word size the computer provides (32-bit, 64-bit, or | |
31 | otherwise). | |
3e132790 | 32 | |
00c6448a MM |
33 | Compiling programs that use the library |
34 | --------------------------------------- | |
35 | The library consists of a folder full of C++ header files (`.hh') and source | |
36 | files (`.cc'). `#include' header files and compile with source files as | |
37 | necessary for your own programs. A Makefile is included that compiles the | |
38 | library source files and the sample program and links them together; you can | |
4a783bbb MM |
39 | easily customize the Makefile to replace the sample with your own program or use |
40 | your own Makefile or IDE. | |
41 | ||
42 | NOTE: It is generally useless to ask me how to set up the library in your IDE | |
43 | because you know more about the IDE than I do (unless it's the Eclipse CDT | |
44 | <http://www.eclipse.org/cdt/>). | |
00c6448a | 45 | |
2531c4e3 MM |
46 | Resources |
47 | --------- | |
48 | The library's Web site (above) provides links to released versions, the current | |
49 | development version, and a mailing list for release announcements, questions, | |
50 | bug reports, and other discussion of the library. I would be delighted to hear | |
51 | from you if you like this library and/or find a good use for it. | |
52 | ||
00c6448a MM |
53 | Bugs and enhancements |
54 | --------------------- | |
55 | The library has been tested by me and others but is by no means bug-free. If | |
2531c4e3 MM |
56 | you find a bug, please report it, whether it comes in the form of compiling |
57 | trouble, a mathematically inaccurate result, or a memory-management blooper | |
58 | (since I use Java, these are altogether too common in my C++). I generally fix | |
59 | all reported bugs. You are also welcome to request enhancements, but I am | |
60 | unlikely to do substantial amounts of work on enhancements at this point. | |
00c6448a MM |
61 | |
62 | Legal | |
63 | ----- | |
64 | I, Matt McCutchen, the sole author of the original Big Integer Library, waive my | |
65 | copyright to it, placing it in the public domain. The library comes with | |
66 | absolutely no warranty. | |
67 | ||
68 | ~~~~ |