Variable: math-largest-emacs-expt

math-largest-emacs-expt is a variable defined in calc-math.el.gz.

Value

307

Documentation

The largest exponent which Calc will convert to an Emacs float.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-math.el.gz
;;; Find the largest power of 10 which is an Emacs float,
;;; then back off by one so that any float d.dddd...eN
;;; is an Emacs float, for acceptable d.dddd....

(defvar math-largest-emacs-expt
  (let ((x 1)
        (pow 1e2))
    ;; The following loop is for efficiency; it should stop when
    ;; 10^(2x) is too large.  This could be indicated by a range
    ;; error when computing 10^(2x) or an infinite value for 10^(2x).
    (while (and
            pow
            (< pow 1.0e+INF))
      (setq x (* 2 x))
      (setq pow (ignore-errors (expt 10.0 (* 2 x)))))
    ;; The following loop should stop when 10^(x+1) is too large.
    (setq pow (ignore-errors (expt 10.0 (1+ x))))
    (while (and
            pow
            (< pow 1.0e+INF))
      (setq x (1+ x))
      (setq pow (ignore-errors (expt 10.0 (1+ x)))))
    (1- x))
  "The largest exponent which Calc will convert to an Emacs float.")