In [1]:
using IntervalArithmetic

In [10]:
left(x::Interval) = Interval(x.lo, mid(x))
right(x::Interval) = Interval(mid(x), x.hi)


function bisect(xx::Vector{Interval})
 
 if length(xx) != 2
 error("Only works for 2 at the moment")
 end
 
 x, y = xx
 
 @show x
 
 intervals = Vector{Interval}[]
 
 push!(intervals, [left(x), left(y)])
 push!(intervals, [left(x), right(y)])
 push!(intervals, [right(x), left(y)])
 push!(intervals, [right(x), right(y)])
 
 intervals
end


Out[10]:
bisect (generic function with 1 method)

In [11]:
a = Interval(0, 1)
b = Interval(0, 1)

bisect([a,b])


x => Interval(0e+00 with 256 bits of precision,1e+00 with 256 bits of precision)
Out[11]:
4-element Array{Array{Interval,1},1}:
 [Interval(0e+00 with 256 bits of precision,5e-01 with 256 bits of precision),Interval(0e+00 with 256 bits of precision,5e-01 with 256 bits of precision)]
 [Interval(0e+00 with 256 bits of precision,5e-01 with 256 bits of precision),Interval(5e-01 with 256 bits of precision,1e+00 with 256 bits of precision)]
 [Interval(5e-01 with 256 bits of precision,1e+00 with 256 bits of precision),Interval(0e+00 with 256 bits of precision,5e-01 with 256 bits of precision)]
 [Interval(5e-01 with 256 bits of precision,1e+00 with 256 bits of precision),Interval(5e-01 with 256 bits of precision,1e+00 with 256 bits of precision)]

In [ ]: