Mercurial > hg > xemacs-beta
comparison lisp/cl-extra.el @ 284:558f606b08ae r21-0b40
Import from CVS: tag r21-0b40
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:34:13 +0200 |
parents | c5d627a313b1 |
children | 57709be46d1b |
comparison
equal
deleted
inserted
replaced
283:fa3d41851a08 | 284:558f606b08ae |
---|---|
514 (defvar least-positive-normalized-float) | 514 (defvar least-positive-normalized-float) |
515 (defvar least-negative-normalized-float) | 515 (defvar least-negative-normalized-float) |
516 (defvar float-epsilon) | 516 (defvar float-epsilon) |
517 (defvar float-negative-epsilon) | 517 (defvar float-negative-epsilon) |
518 | 518 |
519 ;;(defun cl-float-limits () | |
520 (or most-positive-float | |
521 (not (featurep 'lisp-float-type)) | |
522 (let ((x '2e0) y z) | |
523 ;; Find maximum exponent (first two loops are optimizations) | |
524 (while (cl-finite-do '* x x) (setq x (* x x))) | |
525 (while (cl-finite-do '* x (/ x 2)) (setq x (* x (/ x 2)))) | |
526 (while (cl-finite-do '+ x x) (setq x (+ x x))) | |
527 (setq z x y (/ x 2)) | |
528 ;; Now fill in 1's in the mantissa. | |
529 (while (and (cl-finite-do '+ x y) (/= (+ x y) x)) | |
530 (setq x (+ x y) y (/ y 2))) | |
531 (setq most-positive-float x | |
532 most-negative-float (- x)) | |
533 ;; Divide down until mantissa starts rounding. | |
534 (setq x (/ x z) y (/ 16 z) x (* x y)) | |
535 (while (condition-case err (and (= x (* (/ x 2) 2)) (> (/ y 2) 0)) | |
536 (arith-error nil)) | |
537 (setq x (/ x 2) y (/ y 2))) | |
538 (setq least-positive-normalized-float y | |
539 least-negative-normalized-float (- y)) | |
540 ;; Divide down until value underflows to zero. | |
541 (setq x (/ 1 z) y x) | |
542 (while (condition-case err (> (/ x 2) 0) (arith-error nil)) | |
543 (setq x (/ x 2))) | |
544 (setq least-positive-float x | |
545 least-negative-float (- x)) | |
546 (setq x '1e0) | |
547 (while (/= (+ '1e0 x) '1e0) (setq x (/ x 2))) | |
548 (setq float-epsilon (* x 2)) | |
549 (setq x '1e0) | |
550 (while (/= (- '1e0 x) '1e0) (setq x (/ x 2))) | |
551 (setq float-negative-epsilon (* x 2)))) | |
552 ;;) | |
553 | |
519 (defun cl-float-limits () | 554 (defun cl-float-limits () |
520 (or most-positive-float (not (numberp '2e1)) | 555 ;; No-op, defined for old code that calls this to setup the |
521 (let ((x '2e0) y z) | 556 ;; constants. |
522 ;; Find maximum exponent (first two loops are optimizations) | 557 ) |
523 (while (cl-finite-do '* x x) (setq x (* x x))) | |
524 (while (cl-finite-do '* x (/ x 2)) (setq x (* x (/ x 2)))) | |
525 (while (cl-finite-do '+ x x) (setq x (+ x x))) | |
526 (setq z x y (/ x 2)) | |
527 ;; Now fill in 1's in the mantissa. | |
528 (while (and (cl-finite-do '+ x y) (/= (+ x y) x)) | |
529 (setq x (+ x y) y (/ y 2))) | |
530 (setq most-positive-float x | |
531 most-negative-float (- x)) | |
532 ;; Divide down until mantissa starts rounding. | |
533 (setq x (/ x z) y (/ 16 z) x (* x y)) | |
534 (while (condition-case err (and (= x (* (/ x 2) 2)) (> (/ y 2) 0)) | |
535 (arith-error nil)) | |
536 (setq x (/ x 2) y (/ y 2))) | |
537 (setq least-positive-normalized-float y | |
538 least-negative-normalized-float (- y)) | |
539 ;; Divide down until value underflows to zero. | |
540 (setq x (/ 1 z) y x) | |
541 (while (condition-case err (> (/ x 2) 0) (arith-error nil)) | |
542 (setq x (/ x 2))) | |
543 (setq least-positive-float x | |
544 least-negative-float (- x)) | |
545 (setq x '1e0) | |
546 (while (/= (+ '1e0 x) '1e0) (setq x (/ x 2))) | |
547 (setq float-epsilon (* x 2)) | |
548 (setq x '1e0) | |
549 (while (/= (- '1e0 x) '1e0) (setq x (/ x 2))) | |
550 (setq float-negative-epsilon (* x 2)))) | |
551 nil) | |
552 | |
553 | 558 |
554 ;;; Sequence functions. | 559 ;;; Sequence functions. |
555 | 560 |
556 ;XEmacs -- our built-in is more powerful. | 561 ;XEmacs -- our built-in is more powerful. |
557 ;(defun subseq (seq start &optional end) | 562 ;(defun subseq (seq start &optional end) |