diff options
| author | Paul Eggert | 1993-08-10 04:14:17 +0000 |
|---|---|---|
| committer | Paul Eggert | 1993-08-10 04:14:17 +0000 |
| commit | ebe6b8146098faa60cc7731f54c0eba2611d7ff8 (patch) | |
| tree | 09ac97e56d241cd1e077d868e722ecca82ff718a | |
| parent | 2ec5af1103139ca401e649266ff6b11e65580b1c (diff) | |
| download | emacs-ebe6b8146098faa60cc7731f54c0eba2611d7ff8.tar.gz emacs-ebe6b8146098faa60cc7731f54c0eba2611d7ff8.zip | |
(floor*): Use `floor' instead of doing most the work ourselves.
| -rw-r--r-- | lisp/emacs-lisp/cl-extra.el | 15 |
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." | |||
| 387 | (defun floor* (x &optional y) | 387 | (defun floor* (x &optional y) |
| 388 | "Return a list of the floor of X and the fractional part of X. | 388 | "Return a list of the floor of X and the fractional part of X. |
| 389 | With two arguments, return floor and remainder of their quotient." | 389 | With two arguments, return floor and remainder of their quotient." |
| 390 | (if y | 390 | (let ((q (floor x y))) |
| 391 | (if (and (integerp x) (integerp y)) | 391 | (list q (- x (if y (* y q) q))))) |
| 392 | (if (and (>= x 0) (>= y 0)) | ||
| 393 | (list (/ x y) (% x y)) | ||
| 394 | (let ((q (cond ((>= x 0) (- (/ (- x y 1) (- y)))) | ||
| 395 | ((>= y 0) (- (/ (- y x 1) y))) | ||
| 396 | (t (/ (- x) (- y)))))) | ||
| 397 | (list q (- x (* q y))))) | ||
| 398 | (let ((q (floor (/ x y)))) | ||
| 399 | (list q (- x (* q y))))) | ||
| 400 | (if (integerp x) (list x 0) | ||
| 401 | (let ((q (floor x))) | ||
| 402 | (list q (- x q)))))) | ||
| 403 | 392 | ||
| 404 | (defun ceiling* (x &optional y) | 393 | (defun ceiling* (x &optional y) |
| 405 | "Return a list of the ceiling of X and the fractional part of X. | 394 | "Return a list of the ceiling of X and the fractional part of X. |