From f5c47c467de7e52d73b94afc1bf3041c74a04fd1 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Tue, 7 Jun 2016 22:43:49 +0900 Subject: [PATCH] preserve -0.0 when added to exact 0 --- bignum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bignum.c b/bignum.c index a34cea75..b94399cf 100644 --- a/bignum.c +++ b/bignum.c @@ -1202,7 +1202,7 @@ sexp sexp_add (sexp ctx, sexp a, sexp b) { r = sexp_make_fixnum(sum); break; case SEXP_NUM_FIX_FLO: - r = sexp_make_flonum(ctx, sexp_fixnum_to_double(a)+sexp_flonum_value(b)); + r = a == SEXP_ZERO ? b : sexp_make_flonum(ctx, sexp_fixnum_to_double(a)+sexp_flonum_value(b)); break; case SEXP_NUM_FIX_BIG: r = sexp_bignum_normalize(sexp_bignum_add_fixnum(ctx, b, a));