aboutsummaryrefslogtreecommitdiff
path: root/types.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'types.cpp')
-rw-r--r--types.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/types.cpp b/types.cpp
index 8611cc6..de7ef66 100644
--- a/types.cpp
+++ b/types.cpp
@@ -892,7 +892,7 @@ NumObj *IntNumObj::mod(NumObj *_r) {
const mpz_class &rval = static_cast<IntNumObj*>(_r)->val;
if (rval == 0) throw NormalError(RUN_ERR_NUMERIC_OVERFLOW);
mpz_class ret = val % rval;
- if (sgn(ret) != sgn(rval))
+ if (ret != 0 && sgn(ret) != sgn(rval))
ret = ret + rval;
return new IntNumObj(ret);
}