From: Alexey Dejneka Date: Thu, 4 Sep 2003 05:56:08 +0000 (+0000) Subject: 0.8.3.33: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=ca39b7d050ba21a6bf69d2d1030bda0ad7dd6b7b;p=sbcl.git 0.8.3.33: * Fix bug reported by Paul Dietz: (GCD 0 X) returned X instead of (ABS X). --- diff --git a/NEWS b/NEWS index 17c266a..e3cc1b3 100644 --- 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 ) returned . planned incompatible changes in 0.8.x: * (not done yet, but planned:) When the profiling interface settles diff --git a/src/code/numbers.lisp b/src/code/numbers.lisp index cf807c1..1c27cd1 100644 --- a/src/code/numbers.lisp +++ b/src/code/numbers.lisp @@ -1271,8 +1271,8 @@ ;;; 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) diff --git a/tests/arith.pure.lisp b/tests/arith.pure.lisp index 7493d4e..3fc39fc 100644 --- a/tests/arith.pure.lisp +++ b/tests/arith.pure.lisp @@ -102,3 +102,7 @@ (= (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)))) diff --git a/version.lisp-expr b/version.lisp-expr index 8a4486f..6e28095 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".) -"0.8.3.32" +"0.8.3.33"