From c559ae11befe15803f0b734a85e2067e6b8bd3be Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sat, 5 Jan 2013 23:38:20 +0900 Subject: [PATCH] Fixing fixnum results with remainders in bignum sqrt. --- bignum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bignum.c b/bignum.c index f75c41c4..439a8267 100644 --- a/bignum.c +++ b/bignum.c @@ -509,7 +509,7 @@ sexp sexp_bignum_sqrt (sexp ctx, sexp a) { /* Babylonian method */ /* convert back to inexact if non-zero remainder */ rem = sexp_bignum_normalize(rem); if (rem != SEXP_ZERO) - res = sexp_make_flonum(ctx, sexp_bignum_to_double(res)); + res = sexp_make_flonum(ctx, sexp_fixnump(res) ? sexp_unbox_fixnum(res) : sexp_bignum_to_double(res)); } sexp_gc_release4(ctx); return sexp_bignum_normalize(res);