JuliaApproximation / DomainSets.jl

A Julia package for describing domains as continuous sets of elements
MIT License
72 stars 12 forks source link

setdiff ignores whether intervals are open or closed #49

Closed daanhb closed 1 year ago

daanhb commented 4 years ago

I don't have an immediate problem with it, but currently we have:

julia> (-1..1) \ (0..1)
-1..0

julia> typeof(ans)
Interval{:closed,:closed,Int64}

The result of the difference of two closed intervals should probably be a half-open one, i.e., the correct result of [-1,1] \ [0,1] arguably should be:

julia> Interval{:closed,:open,Float64}(-1, 0)
-1.0..0.0 (closed–open)

That would mean changing the setdiff function in interval.jl here.

daanhb commented 2 years ago

Fixed in the dev-0.6 branch:

julia> (-1..1) \ (0..1)
-1..0 (closed–open)

This may break code elsewhere, which relies on the difference of closed intervals being a closed interval. I had to change some non-related tests even within DomainSets making that assumption. So better to go in 0.6.