master: More compact ROUND for integers

stassats via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  002e5c99e4ee0a1ce166fcd8047a61c2d790e3bc (commit)
      from  b8fa70041c0c0819bb18a46f96452e99d760fccd (commit)

- Log -----------------------------------------------------------------
commit 002e5c99e4ee0a1ce166fcd8047a61c2d790e3bc
Author: Stas Boukarev <[email protected]>
Date:   Fri Apr 10 02:54:14 2026 +0300

    More compact ROUND for integers
---
 src/code/numbers.lisp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/code/numbers.lisp b/src/code/numbers.lisp
index 6f8f8bc87..eb298f43b 100644
--- a/src/code/numbers.lisp
+++ b/src/code/numbers.lisp
@@ -674,11 +674,9 @@ The second returned value is the remainder."
                (cond ((or (> thresh abs-divisor)
                           (and (= thresh abs-divisor)
                                (oddp tru)))
-                      (if (or (minusp tru)
-                              (and (zerop tru)
-                                   (neq (minusp number) (minusp divisor))))
-                          (values (- tru 1) (+ rem divisor))
-                          (values (+ tru 1) (- rem divisor))))
+                      (if (eq (minusp number) (minusp divisor))
+                          (values (+ tru 1) (- rem divisor))
+                          (values (- tru 1) (+ rem divisor))))
                      (t
                       (values tru rem)))))))
       ((bignum integer)

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.