Mercurial > hg > xemacs-beta
diff lisp/cl.el @ 1983:9c872f33ecbe
[xemacs-hg @ 2004-04-05 22:49:31 by james]
Add bignum, ratio, and bigfloat support.
author | james |
---|---|
date | Mon, 05 Apr 2004 22:50:11 +0000 |
parents | 023b83f4e54b |
children | 0f60caa73962 |
line wrap: on
line diff
--- a/lisp/cl.el Mon Apr 05 21:50:47 2004 +0000 +++ b/lisp/cl.el Mon Apr 05 22:50:11 2004 +0000 @@ -151,10 +151,8 @@ (defun eql (a b) ; See compiler macro in cl-macs.el "Return t if the two args are the same Lisp object. Floating-point numbers of equal value are `eql', but they may not be `eq'." - (if (floatp a) - (equal a b) - (eq a b))) - + (or (eq a b) + (and (numberp a) (numberp b) (equal a b)))) ;;; Generalized variables. These macros are defined here so that they ;;; can safely be used in .emacs files. @@ -313,7 +311,9 @@ (defun cl-random-time () (let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0)) (while (>= (decf i) 0) (setq v (+ (* v 3) (aref time i)))) - v)) + (if (featurep 'number-types) + (coerce-number v 'fixnum) + v))) (defvar *gensym-counter* (* (logand (cl-random-time) 1023) 100)) @@ -364,11 +364,13 @@ (defvar *random-state* (vector 'cl-random-state-tag -1 30 (cl-random-time))) +;; These constants are defined in C when 'number-types is provided. +(unless (featurep 'number-types) ;;; We use `eval' in case VALBITS differs from compile-time to load-time. -(defconst most-positive-fixnum (eval '(lsh -1 -1)) - "The integer closest in value to positive infinity.") -(defconst most-negative-fixnum (eval '(- -1 (lsh -1 -1))) - "The integer closest in value to negative infinity.") + (defconst most-positive-fixnum (eval '(lsh -1 -1)) + "The integer closest in value to positive infinity.") + (defconst most-negative-fixnum (eval '(- -1 (lsh -1 -1))) + "The integer closest in value to negative infinity.")) ;;; The following are set by code in cl-extra.el (defconst most-positive-float nil