X-Git-Url: https://mattmccutchen.net/bigint/bigint.git/blobdiff_plain/2301f99c6175d543626d61c0bda90e80f85e7eac..3e1327901d299a537a8d932c49dd330f87ac3bda:/BigIntegerUtils.cc diff --git a/BigIntegerUtils.cc b/BigIntegerUtils.cc index 87eb50b..3ac75dc 100644 --- a/BigIntegerUtils.cc +++ b/BigIntegerUtils.cc @@ -12,8 +12,9 @@ std::string easyBUtoString(const BigUnsigned &x) { } std::string easyBItoString(const BigInteger &x) { - return (x.getSign() == BigInteger::negative) ? - (std::string("-") + easyBUtoString(x)) : (easyBUtoString(x)); + return (x.getSign() == BigInteger::negative) + ? (std::string("-") + easyBUtoString(x.getMagnitude())) + : (easyBUtoString(x.getMagnitude())); } BigUnsigned easyStringToBU(const std::string &s) { @@ -51,6 +52,6 @@ std::ostream &operator <<(std::ostream &os, const BigUnsigned &x) { std::ostream &operator <<(std::ostream &os, const BigInteger &x) { if (x.getSign() == BigInteger::negative) os << '-'; - os << (const BigUnsigned &)(x); + os << x.getMagnitude(); return os; }