Function: calculator-fact

calculator-fact is a byte-compiled function defined in calculator.el.gz.

Signature

(calculator-fact X)

Documentation

Simple factorial of X.

Source Code

;; Defined in /usr/src/emacs/lisp/calculator.el.gz
(defun calculator-fact (x)
  "Simple factorial of X."
  (cond ((>= x 1.0e+INF) x)
        ((or (and (floatp x) (isnan x)) (< x 0)) 0.0e+NaN)
        ((>= (calculator-expt (/ x 3.0) x) 1.0e+INF) 1.0e+INF)
        (t (let ((x (truncate x)) (r 1.0))
             (while (> x 0) (setq r (* r x) x (1- x)))
             r))))