From 96c62c30ec9164419c790b2fbea953da2193620f Mon Sep 17 00:00:00 2001 From: Paul Khuong Date: Mon, 26 Apr 2010 21:07:06 +0000 Subject: [PATCH] 1.0.37.61: Ensure GCD always returns positive values Fixes lp#413680. --- NEWS | 1 + src/code/bignum.lisp | 1 + tests/arith.pure.lisp | 6 ++++++ version.lisp-expr | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index fa4088d..5499d30 100644 --- a/NEWS +++ b/NEWS @@ -62,6 +62,7 @@ changes relative to sbcl-1.0.37: :SB-DOC feature. (lp#552564) * bug fix: SB-INTROSPECT build issues on GENGC/PPC. (lp#490490) * bug fix: more robust runtime executable path detection. (lp#375549) + * bug fix: GCD always returns positive values. (lp#413680)) changes in sbcl-1.0.37 relative to sbcl-1.0.36: * enhancement: Backtrace from THROW to uncaught tag on x86oids now shows diff --git a/src/code/bignum.lisp b/src/code/bignum.lisp index 9f46416..af0f06a 100644 --- a/src/code/bignum.lisp +++ b/src/code/bignum.lisp @@ -777,6 +777,7 @@ (setf u-len (make-gcd-bignum-odd u u-len)) (rotatef u v) (rotatef u-len v-len)) + (bignum-abs-buffer u u-len) (setf u (copy-bignum u u-len)) (let ((n (bignum-mod-gcd v1 u))) (ash (bignum-mod-gcd u1 (if (fixnump n) diff --git a/tests/arith.pure.lisp b/tests/arith.pure.lisp index af1932c..6ca3aaa 100644 --- a/tests/arith.pure.lisp +++ b/tests/arith.pure.lisp @@ -359,3 +359,9 @@ < <= = >= > eql eq)))) + +;; GCD used to sometimes return negative values. The following did, on 32 bit +;; builds. +(with-test (:name :gcd) + (assert (plusp (gcd 20286123923750474264166990598656 + 680564733841876926926749214863536422912)))) diff --git a/version.lisp-expr b/version.lisp-expr index cdf6667..b4d6617 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.37.60" +"1.0.37.61" -- 1.7.10.4