Old snapshot `BigIntegerLibrary-2005.03.30'; see the ChangeLog file.
authorMatt McCutchen <hashproduct@gmail.com>
Sat, 27 Jan 2007 21:06:17 +0000 (16:06 -0500)
committerMatt McCutchen <hashproduct@gmail.com>
Sat, 27 Jan 2007 21:06:17 +0000 (16:06 -0500)
BigInteger.cc
CHANGELOG
README

index 69d2dd7..5acf459 100644 (file)
@@ -358,9 +358,11 @@ void BigInteger::subtract(const BigInteger &a, const BigInteger &b) {
        // If a is zero, copy b and flip its sign.  If b is zero, copy a.
        if (a.sign == zero) {
                BigUnsigned::operator =(b);
-               sign = Sign(-sign);
+               // Take the negative of _b_'s, sign, not ours.
+               // Bug pointed out by Sam Larkin on 2005.03.30.
+               sign = Sign(-b.sign);
        } else if (b.sign == zero)
-    operator =(a);
+               operator =(a);
        // If their signs differ, take a.sign and add the magnitudes.
        else if (a.sign != b.sign) {
                sign = a.sign;
index e79ba1e..5f706b0 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,10 @@ Change Log
 ==========
 These entries tell you what was added, fixed, or improved in each version as compared to the previous one.  In case you haven't noticed, a version number roughly corresponds to the release date of that version in `YYYY.MM.DD[.N]' format, where `.N' goes `.2', `.3', etc. if there are multiple versions on the same day.
 
+2005.03.30
+----------
+Sam Larkin found a bug in `BigInteger::subtract'; I fixed it.
+
 2005.01.18
 ----------
 I 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.
diff --git a/README b/README
index 2f71144..211158e 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 +===================================================================+
 | Big Integer Library                                               |
 | A C++ library that does arithmetic on integers of unlimited size. |
-| Version 2005.01.18                                                |
+| Version 2005.03.30                                                |
 +-------------------------------------------------------------------+
 | By Matt McCutchen                                                 |
 | E-mail: hashproduct@verizon.net                                   |