Handbook
Glossary
interval-rem ( i1 i2 -- i3 )
Factor handbook
»
The language
»
Numbers
»
Intervals
»
Interval arithmetic
Prev:
interval-mod ( i1 i2 -- i3 )
Next:
interval-min ( i1 i2 -- i3 )
Vocabulary
math
.
intervals
Inputs
i1
an
interval
i2
an
interval
Outputs
i3
an
interval
Word description
Outputs an interval containing all possible values obtained by applying
rem
to elements of
i1
and
i2
.
Definition
USING:
combinators
kernel
;
IN:
math.intervals
:
interval-rem
( i1 i2 -- i3 )
{
{
[
over
empty-interval?
]
[
drop
]
}
{
[
dup
empty-interval?
]
[
nip
]
}
{
[
dup
full-interval?
]
[
2drop
[0,inf]
]
}
[
nip
(rem-range)
]
}
cond
;