summaryrefslogtreecommitdiffstatshomepage
path: root/py/mpz.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/mpz.c')
-rw-r--r--py/mpz.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/mpz.c b/py/mpz.c
index c0a3d4b0b4..a056a6e8ad 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -820,6 +820,10 @@ bool mpz_is_even(const mpz_t *z) {
}
int mpz_cmp(const mpz_t *z1, const mpz_t *z2) {
+ // to catch comparison of -0 with +0
+ if (z1->len == 0 && z2->len == 0) {
+ return 0;
+ }
int cmp = (int)z2->neg - (int)z1->neg;
if (cmp != 0) {
return cmp;