diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-04-16 04:35:38 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-04-16 04:35:38 +0000 |
commit | bd9c5e7949e33674c4d57b85500b5e4852848809 (patch) | |
tree | 7d186f0c88790452eecbd2d735d658643158c548 /lisp/emacs-lisp | |
parent | eba8dcd060689675c9778392d4ada66395d21a3e (diff) | |
download | emacs-bd9c5e7949e33674c4d57b85500b5e4852848809.tar.gz emacs-bd9c5e7949e33674c4d57b85500b5e4852848809.tar.bz2 emacs-bd9c5e7949e33674c4d57b85500b5e4852848809.zip |
(isqrt): Support expanded range of Lisp integers.
(cl-expt): Bug fix for (expt -1 -N).
(cl-macroexpand-all): Change to support `labels'.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/cl-extra.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 6eadbdb4ca9..5873590d521 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -371,8 +371,8 @@ If so, return the true (non-nil) value returned by PREDICATE." (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 @@ If so, return the true (non-nil) value returned by PREDICATE." (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 @@ This also does some trivial optimizations to make the form prettier." 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))) |