upper bounding index of a substring in case :JUNK-ALLOWED NIL.
** PARSE-INTEGER returned an incorrect index being applied to a
displaced string.
+ ** LCM with two arguments of 0 returns 0 rather than signalling
+ DIVISION-BY-ZERO.
planned incompatible changes in 0.8.x:
* (not done yet, but planned:) When the profiling interface settles
(defun two-arg-lcm (n m)
(declare (integer n m))
- (let ((m (abs m))
- (n (abs n)))
- (multiple-value-bind (max min)
- (if (> m n)
- (values m n)
- (values n m))
- (* (truncate max (gcd n m)) min))))
+ (if (or (zerop n) (zerop m))
+ 0
+ ;; KLUDGE: I'm going to assume that it was written this way
+ ;; originally for a reason. However, this is a somewhat
+ ;; complicated way of writing the algorithm in the CLHS page for
+ ;; LCM, and I don't know why. To be investigated. -- CSR,
+ ;; 2003-09-11
+ (let ((m (abs m))
+ (n (abs n)))
+ (multiple-value-bind (max min)
+ (if (> m n)
+ (values m n)
+ (values n m))
+ (* (truncate max (gcd n m)) min)))))
;;; Do the GCD of two integer arguments. With fixnum arguments, we use the
;;; binary GCD algorithm from Knuth's seminumerical algorithms (slightly
(assert (= (gcd 0 x) (abs x))))
;;; LCM returns a non-negative number
(assert (= (lcm 4 -10) 20))
+(assert (= (lcm 0 0) 0))
;;; PPC bignum arithmetic bug:
(multiple-value-bind (quo rem)
;;; 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.50"
+"0.8.3.51"