diff --git a/src/IntervalArithmetic.jl b/src/IntervalArithmetic.jl index 21c60a268..2946d820a 100644 --- a/src/IntervalArithmetic.jl +++ b/src/IntervalArithmetic.jl @@ -20,7 +20,7 @@ export ×, dot import Base: +, -, *, /, //, fma, - <, >, ==, !=, ⊆, ^, <=, + <, >, ==, !=, ⊆, ^, <=, isapprox, in, zero, one, eps, typemin, typemax, abs, abs2, real, min, max, sqrt, exp, log, sin, cos, tan, cot, inv, cbrt, csc, hypot, sec, exp2, exp10, log2, log10, diff --git a/src/intervals/arithmetic.jl b/src/intervals/arithmetic.jl index ed8360e53..590b01a7e 100644 --- a/src/intervals/arithmetic.jl +++ b/src/intervals/arithmetic.jl @@ -50,6 +50,7 @@ function strictprecedes(a::Interval, b::Interval) end const ≺ = strictprecedes # \prec +isapprox(a::Interval, b::Interval; kwargs...) = isapprox(a.lo, b.lo; kwargs...) && isapprox(a.hi, b.hi; kwargs...) # zero, one, typemin, typemax zero(a::Interval{T}) where T<:Real = Interval(zero(T)) diff --git a/test/interval_tests/numeric.jl b/test/interval_tests/numeric.jl index da7fe2558..507d271e1 100644 --- a/test/interval_tests/numeric.jl +++ b/test/interval_tests/numeric.jl @@ -200,6 +200,10 @@ end # real @test real(@interval(-1, 1)) == Interval(-1, 1) + + a = 0.3..0.7 + b = a + 1e-10 + @test a ≈ b end @testset "Rational tests" begin