Handbook
Glossary
^mod ( x y n -- z )
Factor handbook
»
The language
»
Numbers
»
Mathematical functions
»
Integer functions
Prev:
next-power-of-2 ( m -- n )
Next:
mod-inv ( x n -- y )
Vocabulary
math
.
functions
Inputs
x
a
real
y
a
real
n
a
real
Outputs
z
a
real
Word description
Outputs the result of computing
x^y mod n
.
Definition
USING:
kernel
math
math.functions.private
;
IN:
math.functions
:
^mod
( x y n -- z )
over
0
<
[
[
[
neg
]
dip
^mod
]
keep
mod-inv
]
[
(^mod)
]
if
;
foldable
flushable