improve comparison of terms.

This commit is contained in:
Vítor Santos Costa 2011-02-02 19:00:52 +00:00
parent 857c8c042e
commit 83e918ac68

View File

@ -1299,13 +1299,19 @@ Yap_gmp_tcmp_big_big(Term t1, Term t2)
if (pt1[1] == BIG_INT) { if (pt1[1] == BIG_INT) {
return 1; return 1;
} else { } else if (pt1[1] == BIG_RATIONAL) {
b1 = Yap_BigRatOfTerm(t1); b1 = Yap_BigRatOfTerm(t1);
} else if (pt1[1] == BIG_RATIONAL) {
b1 = Yap_BigRatOfTerm(t1);
} else {
return pt1-pt2;
} }
if (pt2[1] == BIG_INT) { if (pt2[1] == BIG_INT) {
return -1; return -1;
} else { } else if (pt2[1] == BIG_RATIONAL) {
b2 = Yap_BigRatOfTerm(t2); b2 = Yap_BigRatOfTerm(t2);
} else {
return pt1-pt2;
} }
return mpq_cmp(b1, b2); return mpq_cmp(b1, b2);
} }