Old snapshot `BigIntegerLibrary-2004.12.24.2'; see the ChangeLog file.
[bigint/bigint.git] / README
CommitLineData
05780f4b
MM
1=================================================================
2Matt McCutchen's Big Integer Library
3A C++ library that does arithmetic on integers of unlimited size.
4=================================================================
5Version 2004.12.24.2
6
7This library contains two classes, BigUnsigned and BigInteger, that represent nonnegative integers and integers, respectively. Each provides the operations listed below and possibly others:
8+, -, *, /, %, unary -
9+=, -=, *=, /=, %=, ++, --
10==, !=, <, <=, >, >=
11&, |, ^
12
13To get started using this library, look at the code in `sample.cc'. Type `make sample' to compile the sample program in `sample.cc' so you can see what it does.
14
15This library includes a makefile. To compile it, just type `make'; you'll get some `.o' files. Include `.hh' files and link with `.o' files as necessary for your programming projects.
16
17Please see the project Web site at
18 http://mysite.verizon.net/mccutchen/bigint/
19for more information and the latest version.
20
21Change Log:
22===========
23
242004.12.24.2 version:
25I tied down a couple of loose ends involving division/modulo. I added an explanation of put-here vs. overloaded operators in the sample program; this has confused too many people. Miscellaneous other improvements.
26
27I believe that, at this point, the Big Integer Library makes no assumptions about the word size of the machine it is using. `BigUnsigned::Blk' is always an `unsigned long', whatever that may be, and its size is computed with `sizeof' when necessary. However, just in case, I would be interested to have someone test the library on a non-32-bit machine to see if it works.
28
292004.12.24 version:
30This is a _major_ upgrade to the library. Among the things that have changed:
31
32I wrote the original version of the library, particularly the four ``classical algorithms'' in `BigUnsigned.cc', using array indexing. Then I rewrote it to use pointers because I thought that would be faster. But recently, I revisited the code in `BigUnsigned.cc' and found that I could not begin to understand what it was doing.
33
34I have decided that the drawbacks of pointers, increased coding difficulty and reduced code readability, far outweigh their speed benefits. Plus, any modern optimizing compiler should produce fast code either way. Therefore, I rewrote the library to use array indexing again. (Thank goodness for regular-expression find-and-replace. It saved me a lot of time.)
35
36The put-here operations `divide' and `modulo' of each of `BigUnsigned' and `BigInteger' have been supplanted by a single operation `divideWithRemainder'. Read the profuse comments for more information on its exact behavior.
37
38There is a new class `BigUnsignedInABase' that is like `BigUnsigned' but uses a user-specified, small base instead of `256 ^ sizeof(unsigned long)'. Much of the code common to the two has been factored out into `NumberlikeArray'.
39
40`BigUnsignedInABase' facilitates conversion between `BigUnsigned's and digit-by-digit string representations using `std::string'. Convenience routines to do this conversion are in `BigIntegerUtils.hh'. `iostream' compatibility has been improved.
41
42I would like to thank Chris Morbitzer for the e-mail message that catalyzed this major upgrade. He wanted a way to convert a string to a BigInteger. One thing just led to another, roughly in reverse order from how they are listed here.
43
442004.1216 version:
45Brad Spencer pointed out a memory leak in `BigUnsigned::divide'. It is fixed in the December 16, 2004 version.
46
472004.1205 version:
48After months of inactivity, I fixed a bug in the `BigInteger' division routine; thanks to David Allen for reporting the bug. I also added simple routines for decimal output to `std::ostream's, and there is a demo that prints out powers of 3.
49
50===================