Coerce flonums to bignums instead of vice versa in comparisons.

Need to do the same for flonums <=> ratios but the conversion is
a hack right now.
This commit is contained in:
Alex Shinn 2012-11-07 21:40:53 +09:00
parent 8ea2cc0071
commit ab42ea2cfb

View file

@ -1528,10 +1528,8 @@ sexp sexp_compare (sexp ctx, sexp a, sexp b) {
r = sexp_make_fixnum(f < g ? -1 : f == g ? 0 : 1);
break;
case SEXP_NUM_FLO_BIG:
f = sexp_flonum_value(a);
g = sexp_bignum_to_double(b);
r = sexp_make_fixnum(f < g ? -1 : f == g ? 0 : 1);
break;
a = tmp = sexp_double_to_bignum(ctx, sexp_flonum_value(a));
/* ... FALLTHROUGH ... */
case SEXP_NUM_BIG_BIG:
r = sexp_make_fixnum(sexp_bignum_compare(a, b));
break;