/mod ( x y -- z w )
Factor handbook > The language > Numbers > Arithmetic > Modular arithmetic

Prev:rem ( x y -- z )
Next:/i ( x y -- z )


Vocabulary
math

Inputs and outputs
xa real
ya real
zan integer
wa real


Word description
Computes the quotient z and remainder w of dividing x by y, with the remainder being negative if x is negative.
The quotient of two fixnums may overflow and yield a bignum; the remainder is always a fixnum
The quotient and remainder of two bignums is always a bignum.


Examples
USING: kernel math prettyprint ; 5 3 /mod [ . ] bi@
1 2

USING: kernel math prettyprint ; 5/2 1/3 /mod [ . ] bi@
7 1/6


See also
Division by zero

Definition


Methods