0.8.3.33:
authorAlexey Dejneka <adejneka@comail.ru>
Thu, 4 Sep 2003 05:56:08 +0000 (05:56 +0000)
committerAlexey Dejneka <adejneka@comail.ru>
Thu, 4 Sep 2003 05:56:08 +0000 (05:56 +0000)
        * Fix bug reported by Paul Dietz: (GCD 0 X) returned X instead
          of (ABS X).

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

diff --git a/NEWS b/NEWS
index 17c266a..e3cc1b3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2037,6 +2037,7 @@ changes in sbcl-0.8.4 relative to sbcl-0.8.3:
     ** (FLOAT X) for X of type DOUBLE-FLOAT now returns X in all
        circumstances.
     ** optimizer for (EXPT X 0) did not work for X not of type FLOAT.
+    ** (GCD 0 <negative-integer>) returned <negative-integer>.
 
 planned incompatible changes in 0.8.x:
   * (not done yet, but planned:) When the profiling interface settles
index cf807c1..1c27cd1 100644 (file)
 ;;; of 0 before the dispatch so that the bignum code doesn't have to worry
 ;;; about "small bignum" zeros.
 (defun two-arg-gcd (u v)
-  (cond ((eql u 0) v)
-       ((eql v 0) u)
+  (cond ((eql u 0) (abs v))
+       ((eql v 0) (abs u))
        (t
         (number-dispatch ((u integer) (v integer))
           ((fixnum fixnum)
index 7493d4e..3fc39fc 100644 (file)
                   (= (funcall fn 2) x2)
                   (= (funcall fn 3) x3))
        (error "bad results for ~D" x)))))
+
+;;; (GCD 0 x) must return (abs x)
+(dolist (x (list -10 (* 3 most-negative-fixnum)))
+  (assert (= (gcd 0 x) (abs x))))
index 8a4486f..6e28095 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".)
-"0.8.3.32"
+"0.8.3.33"