bigint-2009.05.03
[bigint/bigint.git] / ChangeLog
CommitLineData
00c6448a 1 Change Log
a8b42b68 2
00c6448a
MM
3These entries tell you what was added, fixed, or improved in each version as
4compared to the previous one. In case you haven't noticed, a version number
5roughly corresponds to the release date of that version in `YYYY.MM.DD[.N]'
6format, where `.N' goes `.2', `.3', etc. if there are multiple versions on the
7same day. The topmost version listed is the one you have.
a8b42b68 8
5ccacee5 92009.05.03
4f4a02c2 10----------
c17afa55
MM
11- BigUnsigned::{get,set}Bit: Change two remaining `1 <<' to `Blk(1) <<' to work
12 on systems where sizeof(unsigned int) != sizeof(Blk). Bug reported by Brad
13 Spencer.
4f4a02c2
MM
14- dataToBigInteger: Change a `delete' to `delete []' to avoid leaking memory.
15 Bug reported by Nicolás Carrasco.
16
7b1c6484 172009.03.26
79881c05
MM
18----------
19- BigUnsignedInABase(std::string) Reject digits too big for the base.
20 Bug reported by Niakam Kazemi.
21
61a5a343 222008.07.20
1ed94720
MM
23----------
24Dennis Yew pointed out serious problems with ambiguities and unwanted
25conversions when mixing BigInteger/BigUnsigned and primitive integers. To fix
26these, I removed the implicit conversions from BigInteger/BigUnsigned to
27primitive integers and from BigInteger to BigUnsigned. Removing the
28BigInteger-to-BigUnsigned conversion required changing BigInteger to have a
29BigUnsigned field instead of inheriting from it; this was a complex task but
30ultimately gave a saner design. At the same time, I went through the entire
31codebase, making the formatting and comments prettier and reworking anything I
32thought was unclear. I also added a testsuite (currently for 32-bit systems
33only); it doesn't yet cover the entire library but should help to ensure that
34things work the way they should.
35
36A number of changes from version 2007.07.07 break compatibility with existing
37code that uses the library, but updating that code should be pretty easy:
38- BigInteger can no longer be implicitly converted to BigUnsigned. Use
39 getMagnitude() instead.
40- BigUnsigned and BigInteger can no longer be implicitly converted to primitive
41 integers. Use the toInt() family of functions instead.
42- The easy* functions have been renamed to more mature names:
43 bigUnsignedToString, bigIntegerToString, stringToBigUnsigned,
44 stringToBigInteger, dataToBigInteger.
45- BigInteger no longer supports bitwise operations. Get the magnitude with
46 getMagnitude() and operate on that instead.
47- The old {BigUnsigned,BigInteger}::{divide,modulo} copy-less options have been
48 removed. Use divideWithRemainder instead.
49- Added a base argument to BigUnsignedInABase's digit-array constructor. I
c17afa55 50 ope no one used that constructor in its broken state anyway.
1ed94720
MM
51
52Other notable changes:
53- Added BigUnsigned functions setBlock, bitLength, getBit, setBit.
54- The bit-shifting operations now support negative shift amounts, which shift in
55 the other direction.
56- Added some big-integer algorithms in BigIntegerAlgorithms.hh: gcd,
57 extendedEuclidean, modinv, modexp.
58
0551c03b
MM
592007.07.07
60----------
61Update the "Running the sample program produces this output:" comment in
62sample.cc for the bitwise operators.
63
ef2b7c59
MM
642007.06.14
65----------
66- Implement << and >> for BigUnsigned in response to email from Marco Schulze.
67- Fix name: DOTR_ALIASED -> DTRT_ALIASED.
68- Demonstrate all bitwise operators (&, |, ^, <<, >>) in sample.cc.
69
2406559a 702007.02.16
8c16728a
MM
71----------
72Boris Dessy pointed out that the library threw an exception on "a *= a", so I changed all the put-here operations to handle aliased calls correctly using a temporary copy instead of throwing exceptions.
73
3aaa5ce6
MM
742006.08.14
75----------
76In BigUnsigned::bitXor, change allocate(b2->len) to allocate(a2->len): we should allocate enough space for the longer number, not the shorter one! Thanks to Sriram Sankararaman for pointing this out.
77
be1bdfe2
MM
782006.05.03
79----------
80I ran the sample program using valgrind and discovered a `delete s' that should be `delete [] s' and a `len++' before an `allocateAndCopy(len)' that should have been after an `allocateAndCopy(len + 1)'. I fixed both. Yay for valgrind!
81
26a5f52b
MM
822006.05.01
83----------
84I fixed incorrect results reported by Mohand Mezmaz and related memory corruption on platforms where Blk is bigger than int. I replaced (1 << x) with (Blk(1) << x) in two places in BigUnsigned.cc.
85
918d66f2
MM
862006.04.24
87----------
88Two bug fixes: BigUnsigned "++x" no longer segfaults when x grows in length, and BigUnsigned == and != are now redeclared so as to be usable. I redid the Makefile: I removed the *.tag mechanism and hard-coded the library's header dependencies, I added comments, and I made the Makefile more useful for building one's own programs instead of just the sample.
89
b1f5f69e
MM
902006.02.26
91----------
92A few tweaks in preparation for a group to distribute the library. The project Web site has moved; I updated the references. I fixed a typo and added a missing function in NumberlikeArray.hh. I'm using Eclipse now, so you get Eclipse project files.
93
f316def7
MM
942005.03.30
95----------
96Sam Larkin found a bug in `BigInteger::subtract'; I fixed it.
97
3260eb33
MM
982005.01.18
99----------
100I fixed some problems with `easyDataToBI'. Due to some multiply declared variables, this function would not compile. However, it is a template function, so the compiler parses it and doesn't compile the parsed representation until something uses the function; this is how I missed the problems. I also removed debugging output from this function.
101
826c7bda 1022005.01.17
a8b42b68 103----------
826c7bda 104A fix to some out-of-bounds accesses reported by Milan Tomic (see the comment under `BigUnsigned::divideWithRemainder'). `BigUnsigned::multiply' and `BigUnsigned::divideWithRemainder' implementations neatened up a bit with the help of a function `getShiftedBlock'. I (finally!) introduced a constant `BigUnsigned::N', the number of bits in a `BigUnsigned::Blk', which varies depending on machine word size. In both code and comments, it replaces the much clunkier `8*sizeof(Blk)'. Numerous other small changes. There's a new conversion routine `easyDataToBI' that will convert almost any format of binary data to a `BigInteger'.
a8b42b68
MM
105
106I have inserted a significant number of new comments. Most explain unobvious aspects of the code.
107
1082005.01.06
109----------
110Some changes to the way zero-length arrays are handled by `NumberlikeArray', which fixed a memory leak reported by Milan Tomic.
111
1122004.12.24.2
113------------
114I 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.
115
116I 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.
117
1182004.12.24
119----------
120This is a _major_ upgrade to the library. Among the things that have changed:
121
122I 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.
123
124I 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.)
125
126The 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.
127
128There 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'.
129
130`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.
131
132I 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.
133
1342004.1216
135---------
136Brad Spencer pointed out a memory leak in `BigUnsigned::divide'. It is fixed in the December 16, 2004 version.
137
1382004.1205
139---------
140After 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.
141
00c6448a 142~~~~