Changeset 273


Ignore:
Timestamp:
Jan 13, 2004, 4:48:27 PM (21 years ago)
Author:
Gary Byers
Message:

LCM-2, SIGNUM fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/numbers.lisp

    r251 r273  
    344344        (let* ((small (if (< n0 n1) n0 n1))
    345345               (large (if (eq small n0) n1 n0)))
    346           (* (truncate large (gcd n0 n1)) small))))))
     346          (values (truncate (abs (* n0 n1)) (gcd large small))))))))
    347347
    348348(defun lcm (&lexpr numbers)
     
    544544
    545545(defun signum (x)
    546   (cond ((complexp x) (cis (phase x)))
     546  (cond ((complexp x) (if (zerop x) x (/ x (abs x))))
    547547        ((rationalp x) (if (plusp x) 1 (if (zerop x) 0 -1)))
    548548        ((zerop x) (float 0.0 x))
Note: See TracChangeset for help on using the changeset viewer.