|
|
@@ -181,7 +181,7 @@ bool math::operator> (biginteger const & rhs, biginteger const & lhs) {
|
|
|
biginteger const biginteger::ZERO{0}, biginteger::ONE{1}, biginteger::NEGATIVE_ONE{-1};
|
|
|
|
|
|
std::string biginteger::to_string() const {
|
|
|
- std::vector<char> output(biginteger::SEG_DIGITS * data.size() + 1, '\0');
|
|
|
+ std::vector<char> output(biginteger::SEG_DIGITS * data.size() + 2, '\0');
|
|
|
std::ptrdiff_t idx = 0;
|
|
|
if (is_negative) { output[0] = '-'; ++idx; }
|
|
|
idx += sprintf(output.data() + idx, "%d", data[data.size()-1]);
|