File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -820,6 +820,10 @@ bool mpz_is_even(const mpz_t *z) {
820820}
821821
822822int mpz_cmp (const mpz_t * z1 , const mpz_t * z2 ) {
823+ // to catch comparison of -0 with +0
824+ if (z1 -> len == 0 && z2 -> len == 0 ) {
825+ return 0 ;
826+ }
823827 int cmp = (int )z2 -> neg - (int )z1 -> neg ;
824828 if (cmp != 0 ) {
825829 return cmp ;
Original file line number Diff line number Diff line change 1212print ([~ c for c in cases ])
1313print ([c >> 1 for c in cases ])
1414print ([c << 1 for c in cases ])
15+
16+ # comparison of 0/-0/+0
17+ print (long_zero == 0 )
18+ print (long_neg_zero == 0 )
19+ print (long_one - 1 == 0 )
20+ print (long_neg_one + 1 == 0 )
21+ print (long_zero < 1 )
22+ print (long_zero < - 1 )
23+ print (long_zero > 1 )
24+ print (long_zero > - 1 )
25+ print (long_neg_zero < 1 )
26+ print (long_neg_zero < - 1 )
27+ print (long_neg_zero > 1 )
28+ print (long_neg_zero > - 1 )
You can’t perform that action at this time.
0 commit comments