Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
rem ( x y -- z )
Factor documentation
>
Factor handbook
>
The language
>
Numbers
>
Arithmetic
>
Modular arithmetic
Prev:
mod ( x y -- z )
Next:
/mod ( x y -- z w )
Vocabulary
math
Inputs and outputs
x
a
rational
y
a
rational
z
a
rational
Word description
Computes the remainder of dividing
x
by
y
, with the remainder always positive or zero.
•
Given fixnums, always yields a fixnum.
•
Given bignums, always yields a bignum.
•
Given rationals, always yields a rational.
See also
Division by zero
,
mod
Definition
USING:
kernel
;
IN:
math
:
rem
( x y -- z )
abs
[
mod
]
[
+
]
[
mod
]
tri
;
foldable
flushable