| 1 | |
| 2 | C++ Big Integer Library |
| 3 | (see ChangeLog for version) |
| 4 | |
| 5 | http://www.kepreon.com/~matt/bigint/ |
| 6 | |
| 7 | Written and maintained by Matt McCutchen <hashproduct@gmail.com> |
| 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 |
| 25 | consult the actual header and source files, which are heavily commented. |
| 26 | |
| 27 | Compiling programs that use the library |
| 28 | --------------------------------------- |
| 29 | The library consists of a folder full of C++ header files (`.hh') and source |
| 30 | files (`.cc'). `#include' header files and compile with source files as |
| 31 | necessary for your own programs. A Makefile is included that compiles the |
| 32 | library source files and the sample program and links them together; you can |
| 33 | easily customize the Makefile to replace the sample with your own program, or |
| 34 | you can write your own Makefile. |
| 35 | |
| 36 | Bugs and enhancements |
| 37 | --------------------- |
| 38 | The library has been tested by me and others but is by no means bug-free. If |
| 39 | you find a bug, please report it to me, whether it comes in the form of |
| 40 | compiling trouble, a mathematically inaccurate result, or a memory-management |
| 41 | blooper (since I use Java, these are altogether too common in my C++). I |
| 42 | generally fix all reported bugs. |
| 43 | |
| 44 | You are also welcome to request enhancements, but I am unlikely to do |
| 45 | substantial amounts of work on enhancements at this point. When I fix a bug you |
| 46 | report or make an enhancement you request, I will generally credit you by name |
| 47 | in the source code and/or the Change Log unless you request otherwise. New |
| 48 | versions of the library will be available at its Web site (above). |
| 49 | |
| 50 | Note |
| 51 | ---- |
| 52 | I would be delighted to hear from you if you like this library and/or find a |
| 53 | good use for it. |
| 54 | |
| 55 | Legal |
| 56 | ----- |
| 57 | I, Matt McCutchen, the sole author of the original Big Integer Library, waive my |
| 58 | copyright to it, placing it in the public domain. The library comes with |
| 59 | absolutely no warranty. |
| 60 | |
| 61 | ~~~~ |