mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
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:
parent
8ea2cc0071
commit
ab42ea2cfb
1 changed files with 2 additions and 4 deletions
6
bignum.c
6
bignum.c
|
@ -1528,10 +1528,8 @@ sexp sexp_compare (sexp ctx, sexp a, sexp b) {
|
||||||
r = sexp_make_fixnum(f < g ? -1 : f == g ? 0 : 1);
|
r = sexp_make_fixnum(f < g ? -1 : f == g ? 0 : 1);
|
||||||
break;
|
break;
|
||||||
case SEXP_NUM_FLO_BIG:
|
case SEXP_NUM_FLO_BIG:
|
||||||
f = sexp_flonum_value(a);
|
a = tmp = sexp_double_to_bignum(ctx, sexp_flonum_value(a));
|
||||||
g = sexp_bignum_to_double(b);
|
/* ... FALLTHROUGH ... */
|
||||||
r = sexp_make_fixnum(f < g ? -1 : f == g ? 0 : 1);
|
|
||||||
break;
|
|
||||||
case SEXP_NUM_BIG_BIG:
|
case SEXP_NUM_BIG_BIG:
|
||||||
r = sexp_make_fixnum(sexp_bignum_compare(a, b));
|
r = sexp_make_fixnum(sexp_bignum_compare(a, b));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue