diff --git a/Project.toml b/Project.toml index 8df0c7368..1402ad95f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "IntervalArithmetic" uuid = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" repo = "https://github.com/JuliaIntervals/IntervalArithmetic.jl.git" -version = "0.20.5" +version = "0.20.6" [deps] CRlibm = "96374032-68de-5a5b-8d9e-752f78720389" diff --git a/src/multidim/intervalbox.jl b/src/multidim/intervalbox.jl index df7db112d..7cd545d4e 100644 --- a/src/multidim/intervalbox.jl +++ b/src/multidim/intervalbox.jl @@ -81,6 +81,11 @@ end ∈(X::AbstractVector, Y::IntervalBox{N,T}) where {N,T} = all(X .∈ Y) ∈(X, Y::IntervalBox{N,T}) where {N,T} = throw(ArgumentError("$X ∈ $Y is not defined")) +# mixing intervals with one-dimensional interval boxes +for op in (:⊆, :⊂, :⊃, :∩, :∪) + @eval $(op)(a::Interval, X::IntervalBox{1}) = $(op)(a, first(X)) + @eval $(op)(X::IntervalBox{1}, a::Interval) = $(op)(first(X), a) +end #= On Julia 0.6 can now write diff --git a/test/multidim_tests/multidim.jl b/test/multidim_tests/multidim.jl index dfe9ce775..d210da253 100644 --- a/test/multidim_tests/multidim.jl +++ b/test/multidim_tests/multidim.jl @@ -66,7 +66,12 @@ let X, A # avoid problems with global variables @test A ∪ B.v == B end - + x = 0.5 .. 3 + a = IntervalBox(A[1]) # 1 .. 2 + @test !(x ⊆ a) && a ⊆ x + @test !(x ⊂ a) && a ⊂ x + @test x ∩ a == a ∩ x == A[1] + @test x ∪ a == a ∪ x == x X = IntervalBox(1..2, 3..4) Y = IntervalBox(3..4, 3..4)