feat: finish robustness testing

This commit is contained in:
2023-11-01 19:03:50 +08:00
parent ec04b327e9
commit ddde29da3a
2 changed files with 30 additions and 16 deletions

View File

@ -726,15 +726,15 @@ inline void UnsignedDivide(int2048 &A, const int2048 *pB) {
A = std::move(res_hat);
}
int2048 &int2048::Divide(const int2048 &B) {
if (this == &B) {
*this = std::move(int2048(1));
return *this;
}
if (B.num_length == 1 && B.val[0] == 0) {
*this = std::move(int2048(0));
return *this;
// throw "Divide: divide by zero";
}
if (this == &B) {
*this = std::move(int2048(1));
return *this;
}
int2048 origin_A(*this);
int flag_store = this->flag * B.flag;
UnsignedDivide(*this, &B);