AnderGray / IntervalUnionArithmetic.jl

An implementation of interval union arithmetic in Julia
MIT License
11 stars 4 forks source link

`==` is not defined for `IntervalUnion` #17

Closed abraunst closed 2 years ago

abraunst commented 2 years ago
julia> using IntervalUnionArithmetic
julia> intervalUnion(1,2) == Interval(1,2) ∪ ∅
false

julia> intervalUnion(1,2) == ∅
ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type Vector{Interval{Float64}}
Closest candidates are:
  convert(::Type{T}, ::LinearAlgebra.Factorization) where T<:AbstractArray at ~/src/julia/build1.7/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/factorization.jl:58
...
abraunst commented 2 years ago

another function that is not defined but could be is isempty

AnderGray commented 2 years ago

Thanks for spotting this and raising the issue! PR #18 has been opened

I think the desired functionality is added. But this also returns true:

julia> intervalUnion(1, 2) == interval(1, 2)
true

I think it's fine, but perhaps we don't want it?

abraunst commented 2 years ago

Wow, that was fast! Thank you so much for this. I also think that it's perfect to have a well defined equality between IntervalUnion and Interval :)