From 708f22c6af8c61dba2628f16d95b4e2d5b66dc1e Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Fri, 22 Aug 2003 01:17:48 +0000 Subject: [PATCH] (scm_difference): Correction to bignum - negative inum. --- libguile/numbers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libguile/numbers.c b/libguile/numbers.c index 5ef1310e4..7b65814bb 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -3370,7 +3370,10 @@ scm_difference (SCM x, SCM y) { SCM result = scm_i_mkbig (); - mpz_sub_ui (SCM_I_BIG_MPZ (result), SCM_I_BIG_MPZ (x), yy); + if (yy >= 0) + mpz_sub_ui (SCM_I_BIG_MPZ (result), SCM_I_BIG_MPZ (x), yy); + else + mpz_add_ui (SCM_I_BIG_MPZ (result), SCM_I_BIG_MPZ (x), -yy); scm_remember_upto_here_1 (x); if ((sgn_x < 0 && (yy > 0)) || ((sgn_x > 0) && yy < 0))