abacus: bignum: trim zeros after a subtraction

This way we keep a canonicalized version of the result.
This commit is contained in:
Bruno BELANYI 2021-08-22 13:53:22 +02:00
parent 3397bf4310
commit cfa19a60ba

View file

@ -82,6 +82,8 @@ digits_type do_substraction(digits_type const& lhs, digits_type const& rhs) {
std::transform(complement.begin(), complement.end(), complement.begin(), std::transform(complement.begin(), complement.end(), complement.begin(),
take_complement); take_complement);
do_trim_leading_zeros(complement);
return complement; return complement;
} }