X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Farbint.cpp;h=8af84f951f39694ad309e9ab96cb28a693ddd39b;hp=df6da8d136be16892fe3d0e330848e8c99bbdb20;hb=888817a67a9d840be66b52811b01eb77f10ff3e6;hpb=d2a8386f675fc01216c29e96d35518789b25965b diff --git a/src/arbint.cpp b/src/arbint.cpp index df6da8d..8af84f9 100644 --- a/src/arbint.cpp +++ b/src/arbint.cpp @@ -271,7 +271,16 @@ string Arbint::Str(const string & base) const { string s(""); Arbint cpy(*this); - + unsigned b = base.size(); + while (cpy > Arbint(0L)) + { + //Debug("cpy is %s", cpy.DigitStr().c_str()); + unsigned c = (unsigned)(cpy % Arbint(b)).AsDigit(); + s += base[c]; + cpy /= Arbint(b); + } + if (m_sign) + s += '-'; reverse(s.begin(), s.end()); return s; }