(index ("xgcd" 0) ("mod+" 229) ("mod-" 463) ("mod*" 763) ("mod/" 1001) ("modexpt" 1481) ("with-modulus" 1815))
(def (sig (procedure "(xgcd a b)" (id xgcd))) (p "Computes the \"extended greatest common divisor\" of a and b, ie. it returns the two values x and y that constitute the solution of the equation") (pre " x*a + y*b = gcd(a, b)"))
(def (sig (procedure "((mod+ modulus) n ...)" (id mod+))) (p "Computes the sum of all " (tt "n") " parameters just like the standard procedure " (tt "+") " does, but operating on the finite field with the given " (tt "modulus") "."))
(def (sig (procedure "((mod- modulus) a n ...)" (id mod-))) (p "Computes the difference of " (tt "a") " and all " (tt "n") " parameters or the additive inverse of " (tt "a") " just like the standard procedure " (tt "-") " does, but operating on the finite field with the given " (tt "modulus") "."))
(def (sig (procedure "((mod* modulus) n ...)" (id mod*))) (p "Computes the product of all " (tt "n") " parameters just like the standard procedure " (tt "*") " does, but operating on the finite field with the given " (tt "modulus") "."))
(def (sig (procedure "((mod/ modulus) a n ...)" (id mod/))) (p "Computes the quotient of " (tt "a") " and all " (tt "n") " parameters or the multiplicative inverse of " (tt "a") " just like the standard procedure " (tt "/") " does, but operating on the finite field with the given " (tt "modulus") ".") (p "Note that a unique multiplicative inverse of an element in a finite field only exists if the element and the modulus are coprime. This procedure only works in that case."))
(def (sig (procedure "((modexpt modulus) a b)" (id modexpt))) (p "Computes a raised to the power of b modulo the given modulus, but does so far more efficiently than using") (pre " (modulo (* a b) modulus).") (p "If " (tt "b") " is negative, the multiplicative inverse of " (tt "a") " is raised to the power of " (tt "(abs b)") "."))
(def (sig (syntax "(with-modulus modulus body ...)" (id with-modulus))) (p "Overloads the symbols " (tt "+") ", " (tt "add1") ", " (tt "-") ", " (tt "sub1") ", " (tt "*") ", " (tt "/") " and " (tt "expt") " inside " (tt "body") " with the modular versions operating on the finite field with the given " (tt "modulus") " instead of the standard arithmetic procedures."))
