Mercurial > emacs
changeset 15029:ba44a899c055
(isqrt): Support expanded range of Lisp integers.
(cl-expt): Bug fix for (expt -1 -N).
(cl-macroexpand-all): Change to support `labels'.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 16 Apr 1996 04:35:38 +0000 |
parents | 4572159ddf04 |
children | 257fd294d7cb |
files | lisp/emacs-lisp/cl-extra.el |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emacs-lisp/cl-extra.el Tue Apr 16 03:57:23 1996 +0000 +++ b/lisp/emacs-lisp/cl-extra.el Tue Apr 16 04:35:38 1996 +0000 @@ -371,8 +371,8 @@ (defun isqrt (a) "Return the integer square root of the argument." (if (and (integerp a) (> a 0)) - (let ((g (cond ((>= a 1000000) 10000) ((>= a 10000) 1000) - ((>= a 100) 100) (t 10))) + (let ((g (cond ((<= a 100) 10) ((<= a 10000) 100) + ((<= a 1000000) 1000) (t a))) g2) (while (< (setq g2 (/ (+ g (/ a g)) 2)) g) (setq g g2)) @@ -381,7 +381,7 @@ (defun cl-expt (x y) "Return X raised to the power of Y. Works only for integer arguments." - (if (<= y 0) (if (= y 0) 1 (if (memq x '(-1 1)) x 0)) + (if (<= y 0) (if (= y 0) 1 (if (memq x '(-1 1)) (cl-expt x (- y)) 0)) (* (if (= (% y 2) 0) 1 x) (cl-expt (* x x) (/ y 2))))) (or (and (fboundp 'expt) (subrp (symbol-function 'expt))) (defalias 'expt 'cl-expt)) @@ -890,7 +890,10 @@ cl-closure-vars) '((quote --cl-rest--))))))) (list (car form) (list* 'lambda (cadadr form) body)))) - form)) + (let ((found (assq (cadr form) env))) + (if (eq (cadr (caddr found)) 'cl-labels-args) + (cl-macroexpand-all (cadr (caddr (cadddr found))) env) + form)))) ((memq (car form) '(defun defmacro)) (list* (car form) (nth 1 form) (cl-macroexpand-body (cddr form) env))) ((and (eq (car form) 'progn) (not (cddr form)))