abacus: bignum: fix comparison of negative numbers

This commit is contained in:
Bruno BELANYI 2022-02-17 10:03:21 +01:00
parent 3e5133da1a
commit a382b299b0
2 changed files with 33 additions and 1 deletions

View file

@ -363,7 +363,11 @@ bool BigNum::less_than(BigNum const& rhs) const {
return sign_ < rhs.sign_;
}
return do_less_than(digits_, rhs.digits_);
if (is_positive()) {
return do_less_than(digits_, rhs.digits_);
} else {
return do_less_than(rhs.digits_, digits_);
}
}
void BigNum::canonicalize() {