From ab42ea2cfb8a72df37194e6d7b4f658253c48b68 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 7 Nov 2012 21:40:53 +0900 Subject: [PATCH] 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. --- bignum.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bignum.c b/bignum.c index a361194d..79a86c89 100644 --- a/bignum.c +++ b/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); 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;