Function: calcFunc-perm

calcFunc-perm is an autoloaded and byte-compiled function defined in calc-comb.el.gz.

Signature

(calcFunc-perm N M)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-comb.el.gz
(defun calcFunc-perm (n m)   ; [I I I] [F F F] [Public]
  (cond ((and (integerp n) (integerp m) (<= m n) (>= m 0))
	 (math-factorial-iter m (1+ (- n m)) 1))
	((or (not (math-num-integerp n))
	     (and (math-messy-integerp n) (Math-lessp 100 n))
	     (not (math-num-integerp m))
	     (and (math-messy-integerp m) (Math-lessp 100 m)))
	 (or (math-realp n) (equal n '(var inf var-inf))
	     (math-reject-arg n 'realp))
	 (or (math-realp m) (equal m '(var inf var-inf))
	     (math-reject-arg m 'realp))
	 (and (math-num-integerp n) (math-negp n) (math-reject-arg n 'range))
	 (and (math-num-integerp m) (math-negp m) (math-reject-arg m 'range))
	 (math-div (calcFunc-fact n) (calcFunc-fact (math-sub n m))))
	(t
	 (let ((tn (math-trunc n))
	       (tm (math-trunc m)))
	   (math-inexact-result)
	   (or (integerp tn) (math-reject-arg tn 'fixnump))
	   (or (integerp tm) (math-reject-arg tm 'fixnump))
	   (or (and (<= tm tn) (>= tm 0)) (math-reject-arg tm 'range))
	   (math-with-extra-prec 1
	     (math-factorial-iter tm (1+ (- tn tm)) '(float 1 0)))))))