summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@twinsun.com>1993-08-10 04:14:17 +0000
committerPaul Eggert <eggert@twinsun.com>1993-08-10 04:14:17 +0000
commit7d06f9c538483bb626e9735c8025ac5a6bf5bb20 (patch)
treebdae17a5e0f9bc05282c4cad268bb67a0636e908
parent57b9567b0c95840ada99e8e2eafaf1703217803b (diff)
downloademacs-7d06f9c538483bb626e9735c8025ac5a6bf5bb20.tar.gz
(floor*): Use `floor' instead of doing most the work ourselves.
-rw-r--r--lisp/emacs-lisp/cl-extra.el15
1 files changed, 2 insertions, 13 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 5b1fcc49b3d..abd980a6020 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -387,19 +387,8 @@ If so, return the true (non-nil) value returned by PREDICATE."
(defun floor* (x &optional y)
"Return a list of the floor of X and the fractional part of X.
With two arguments, return floor and remainder of their quotient."
- (if y
- (if (and (integerp x) (integerp y))
- (if (and (>= x 0) (>= y 0))
- (list (/ x y) (% x y))
- (let ((q (cond ((>= x 0) (- (/ (- x y 1) (- y))))
- ((>= y 0) (- (/ (- y x 1) y)))
- (t (/ (- x) (- y))))))
- (list q (- x (* q y)))))
- (let ((q (floor (/ x y))))
- (list q (- x (* q y)))))
- (if (integerp x) (list x 0)
- (let ((q (floor x)))
- (list q (- x q))))))
+ (let ((q (floor x y)))
+ (list q (- x (if y (* y q) q)))))
(defun ceiling* (x &optional y)
"Return a list of the ceiling of X and the fractional part of X.