Function: math-use-emacs-fn

math-use-emacs-fn is a byte-compiled function defined in calc-math.el.gz.

Signature

(math-use-emacs-fn FN X)

Documentation

Use the native Emacs function FN to evaluate the Calc number X.

If this can't be done, return NIL.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-math.el.gz
(defun math-use-emacs-fn (fn x)
  "Use the native Emacs function FN to evaluate the Calc number X.
If this can't be done, return NIL."
  (and
   (<= calc-internal-prec math-emacs-precision)
   (math-realp x)
   (let* ((xpon (+ (nth 2 x) (1- (math-numdigs (nth 1 x))))))
     (and (<= math-smallest-emacs-expt xpon)
          (<= xpon math-largest-emacs-expt)
          (ignore-errors
            (math-read-number
             (number-to-string
              (funcall fn
		       (string-to-number
			(let
                            ((calc-number-radix 10)
                             (calc-twos-complement-mode nil)
                             (calc-float-format (list 'float calc-internal-prec))
                             (calc-group-digits nil)
                             (calc-point-char "."))
			  (math-format-number (math-float x))))))))))))