Function: math-pow-mod

math-pow-mod is an autoloaded and byte-compiled function defined in calc-arith.el.gz.

Signature

(math-pow-mod A B M)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-arith.el.gz
;;; This assumes A < M and M > 0.
(defun math-pow-mod (a b m)   ; [R R R R]
  (if (and (Math-integerp a) (Math-integerp b) (Math-integerp m))
      (if (Math-negp b)
	  (math-div-mod 1 (math-pow-mod a (Math-integer-neg b) m) m)
	(if (eq m 1)
	    0
	  (math-pow-mod-step a b m)))
    (math-mod (math-pow a b) m)))