Handbook
Glossary
interval-max ( i1 i2 -- i3 )
Factor handbook
»
The language
»
Numbers
»
Intervals
»
Interval arithmetic
Prev:
interval-min ( i1 i2 -- i3 )
Next:
interval-shift ( i1 i2 -- i3 )
Vocabulary
math
.
intervals
Inputs
i1
an
interval
i2
an
interval
Outputs
i3
an
interval
Word description
Outputs the interval values obtained by lifting the
max
word to
i1
and
i2
.
Definition
USING:
accessors
combinators
kernel
math.order
sequences
;
IN:
math.intervals
:
interval-max
( i1 i2 -- i3 )
{
{
[
over
empty-interval?
]
[
drop
]
}
{
[
dup
empty-interval?
]
[
nip
]
}
{
[
2dup
[
full-interval?
]
both?
]
[
drop
]
}
{
[
over
full-interval?
]
[
nip
from>>
first
[a,inf]
]
}
{
[
dup
full-interval?
]
[
drop
from>>
first
[a,inf]
]
}
[
[
interval-closure
]
bi@
[
max
]
interval-op
nan-not-ok
]
}
cond
;