Handbook
Glossary
interval-bitxor ( i1 i2 -- i3 )
Factor handbook
»
The language
»
Numbers
»
Intervals
»
Interval arithmetic
Prev:
interval-bitor ( i1 i2 -- i3 )
Next:
interval-1+ ( i1 -- i2 )
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
bitxor
to elements of
i1
and
i2
.
Definition
USING:
combinators
kernel
math
math.intervals.private
;
IN:
math.intervals
:
interval-bitxor
( i1 i2 -- i3 )
[
{
{
[
2dup
[
interval-nonnegative?
]
both?
]
[
max-upper-bound
bit-weight
1
-
[0,b]
]
}
{
[
2dup
[
interval-negative?
]
both?
]
[
min-lower-bound
bit-weight
1
-
[0,b]
]
}
[
interval-union
interval-bit-weight
[
neg
]
[
1
-
]
bi
[a,b]
]
}
cond
]
do-empty-interval
;