Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/domains/interval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ function point_in_domain(d::AbstractInterval{T}) where {T<:Integer}
end
end

# TODO: type-piracy, should be removed in the next breaking release
function isapprox(d1::AbstractInterval, d2::AbstractInterval;
atol=default_tolerance(d1),
rtol=Base.rtoldefault(eltype(d1), eltype(d2), atol))

isapprox(d1::AbstractInterval, d2::AbstractInterval) =
isapprox(leftendpoint(d1), leftendpoint(d2); atol=default_tolerance(d1)) &&
isapprox(rightendpoint(d1), rightendpoint(d2); atol=default_tolerance(d1))
isapprox(leftendpoint(d1), leftendpoint(d2); atol, rtol) &&
isapprox(rightendpoint(d1), rightendpoint(d2); atol, rtol)
end


boundary(d::AbstractInterval) = Point(leftendpoint(d)) ∪ Point(rightendpoint(d))
Expand Down
2 changes: 1 addition & 1 deletion test/test_domain_interval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function test_intervals()

@test (0..1) ≈ (1e-16..1)
@test (-1..0) ≈ (-1..1e-16)
@test isapprox(HalfLine(), 0..Inf)
@test isapprox(HalfLine(), 0..Inf, atol=100eps())
end

@testset "mapping between intervals" begin
Expand Down