Skip to content

Commit 737eb81

Browse files
authored
domainscompatible for different closedness (#306)
1 parent 5676983 commit 737eb81

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.7.45"
3+
version = "0.7.46"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/Domain.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,19 @@ const IntervalOrSegmentDomain{T} = Union{AbstractInterval{T}, SegmentDomain{T}}
6262
canonicaldomain(d::IntervalOrSegmentDomain) = ChebyshevInterval{real(prectype(d))}()
6363

6464
domainscompatible(a,b) = domainscompatible(domain(a),domain(b))
65-
domainscompatible(a::Domain,b::Domain) = isambiguous(a) || isambiguous(b) ||
66-
isapprox(a,b)
65+
_isapprox(a, b) = isapprox(a,b)
66+
function _isapprox(a::Interval, b::Interval)
67+
# hacky compat for DomainSets v0.6,
68+
# where comparing open and closed intevals throws an error
69+
# However, we don't need to compare at all if the endpoints differ
70+
# this introduces a duplicate check, but that's probably ok
71+
isapprox(leftendpoint(a), leftendpoint(b), atol=100eps(prectype(a))) &&
72+
isapprox(rightendpoint(a), rightendpoint(b), atol=100eps(prectype(a))) &&
73+
isapprox(a, b)
74+
end
75+
function domainscompatible(a::Domain, b::Domain)
76+
isambiguous(a) || isambiguous(b) || _isapprox(a, b)
77+
end
6778

6879
domainscompatible(::ChebyshevInterval, ::ChebyshevInterval) = true
6980

0 commit comments

Comments
 (0)