From 3727bc7d599c24715a66de3e899a82b6f07d1aac Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 21 Sep 2018 23:08:52 -0700 Subject: [PATCH] Fix (+ bignum float) bug MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * src/data.c (bignum_arith_driver): Fix typo: missing ‘return’. * test/src/data-tests.el (data-tests-bignum): Test for the typo. --- src/data.c | 4 ++-- test/src/data-tests.el | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/data.c b/src/data.c index 1e97d9efa15..cc080372d8b 100644 --- a/src/data.c +++ b/src/data.c @@ -2920,8 +2920,8 @@ bignum_arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args, val = args[argnum]; CHECK_NUMBER_COERCE_MARKER (val); if (FLOATP (val)) - float_arith_driver (code, nargs, args, argnum, - mpz_get_d (*accum), val); + return float_arith_driver (code, nargs, args, argnum, + mpz_get_d (*accum), val); } } diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 701e579ae2e..3cd4802a981 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -547,6 +547,16 @@ comparing the subr with a much slower lisp implementation." (should (<= b-1 b0)) (should (<= b-1 b-1)) + (should (= (+ f0 b0) (+ b0 f0))) + (should (= (+ f0 b-1) (+ b-1 f0))) + (should (= (+ f-1 b0) (+ b0 f-1))) + (should (= (+ f-1 b-1) (+ b-1 f-1))) + + (should (= (* f0 b0) (* b0 f0))) + (should (= (* f0 b-1) (* b-1 f0))) + (should (= (* f-1 b0) (* b0 f-1))) + (should (= (* f-1 b-1) (* b-1 f-1))) + (should (= b0 f0)) (should (= b0 b0)) -- 2.39.2