Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
/mod ( x y -- z w )
Factor documentation
>
Factor handbook
>
The language
>
Numbers
>
Arithmetic
>
Modular arithmetic
Prev:
rem ( x y -- z )
Next:
/i ( x y -- z )
Vocabulary
math
Inputs and outputs
x
an
integer
y
an
integer
z
an
integer
w
an
integer
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.
See also
Division by zero
Definition
IN:
math
MATH:
/mod
( x y -- z w )
foldable
flushable
Methods
USING:
math
math.private
;
M:
bignum
/mod
bignum/mod
;
inline
USING:
math
math.private
;
M:
fixnum
/mod
fixnum/mod
;
inline
USING:
kernel
math
;
M:
ratio
/mod
[
/i
]
2keep
mod
;