1.0.37.61: Ensure GCD always returns positive values
authorPaul Khuong <pvk@pvk.ca>
Mon, 26 Apr 2010 21:07:06 +0000 (21:07 +0000)
committerPaul Khuong <pvk@pvk.ca>
Mon, 26 Apr 2010 21:07:06 +0000 (21:07 +0000)
 Fixes lp#413680.

NEWS
src/code/bignum.lisp
tests/arith.pure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index fa4088d..5499d30 100644 (file)
--- 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
index 9f46416..af0f06a 100644 (file)
         (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)
index af1932c..6ca3aaa 100644 (file)
                       < <= = >= >
                       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))))
index cdf6667..b4d6617 100644 (file)
@@ -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"