diff --git a/examples/examples.jl b/examples/examples.jl index 0501423..2bfcc2b 100644 --- a/examples/examples.jl +++ b/examples/examples.jl @@ -5,11 +5,11 @@ function sawtooth(X::IntervalBox) x, y = X - x = x ⊓ (-1..1) - y = y ⊓ (-2..2) + x = x ⊓ interval(-1, 1) + y = y ⊓ interval(-2, 2) y = y ⊓ (2x) - x = x ⊓ (y/2) + x = x ⊓ (y / 2) return IntervalBox(x, y) end @@ -38,7 +38,7 @@ function cube0(X::IntervalBox) # contractor for y=x^3, x>=0 x, y = X - x = x ⊓ (0..∞) + x = x ⊓ (interval(0, Inf)) y = y ⊓ (x ^ 3) x = x ⊓ interval(inf(y) ^ (1/3), sup(y)^(1/3)) # not rigorous! diff --git a/src/IntervalContractors.jl b/src/IntervalContractors.jl index 3346acc..2f9acca 100644 --- a/src/IntervalContractors.jl +++ b/src/IntervalContractors.jl @@ -20,8 +20,6 @@ using IntervalBoxes const half_pi = ExactReal(0.5) * interval(pi) const two_pi = ExactReal(2.0) * interval(pi) - -const ∞ = Inf # # Base.:⊔(f::Function, g::Function) = X -> ( f(X) ⊔ g(X) ) # Base.:⊓(f::Function, g::Function) = X -> ( f(X) ⊓ g(X) ) # or f(g(X)) for contractors diff --git a/src/arithmetic.jl b/src/arithmetic.jl index 3518185..bf51b45 100644 --- a/src/arithmetic.jl +++ b/src/arithmetic.jl @@ -148,8 +148,8 @@ function power_rev(a::Interval{T}, b::Interval{T}, n::Integer) where T # a = b^ b2 = b ⊓ (-root) elseif isodd(n) - pos_root = (a ⊓ (0..∞)) ^ (1//n) - neg_root = -( ( (-a) ⊓ (0..∞) ) ^ (1//n) ) + pos_root = (a ⊓ interval(0, Inf)) ^ (1//n) + neg_root = -( ( (-a) ⊓ (interval(0, Inf)) ) ^ (1//n) ) b1 = b ⊓ pos_root b2 = b ⊓ neg_root @@ -207,7 +207,7 @@ sqrt_rev(a,b) = sqrt_rev(promote(a,b)...) sqr_rev(c::Interval[, x::Interval]) Reverse square. Calculates the preimage of `a = x²`. If `x` is not provided, then -byt default ``[-∞, ∞]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. +byt default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output @@ -230,7 +230,7 @@ end abs_rev(c::Interval[, x::Interval]) Reverse absolute value. Calculates the preimage of `a = |x|`. If `x` is not provided, then -byt default ``[-∞, ∞]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. +byt default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output @@ -241,7 +241,7 @@ The pair `(c, x_new)` where """ function abs_rev(y, x = entireinterval(y)) # y = abs(x); refine x - y_new = y ⊓ (0..∞) + y_new = y ⊓ (interval(0, Inf)) x1 = y_new ⊓ x x2 = -(y_new ⊓ (-x)) @@ -254,9 +254,9 @@ Reverse sign """ function sign_rev(a::Interval, b::Interval) # a = sqrt(b) - (a == 1.0) && b = b ⊓ (0..∞) - (a == 0.0) && b = b ⊓ (0.0..0.0) - (a == -1.0) && b = b ⊓ (-∞..0.0) + (a == 1.0) && b = b ⊓ (interval(0, Inf)) + (a == 0.0) && b = b ⊓ (0.interval(0, 0).0) + (a == -1.0) && b = b ⊓ (-interval(Inf, 0).0) return a, b end @@ -269,7 +269,7 @@ sign_rev(a,b) = sign_rev(promote(a,b)...) mul_rev_IEEE1788(b::Interval, c::Interval[, x::Interval]) Reverse multiplication. Computes the preimage of ``c = x * b`` with respect to `x`. -If `x` is not provided, then by default ``[-∞, ∞]`` is used. +If `x` is not provided, then by default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output @@ -282,7 +282,7 @@ mul_rev_IEEE1788(b, c, x = entireinterval(b)) = mul_rev(c, x, b)[2] pow_rev1(b::Interval, c::Interval[, x::Interval]) Reverse power 1. Computes the preimage of ``c=xᵇ`` with respect to `x`. If `x` is not provided, -then byt default ``[-∞, ∞]`` is used.. See section 10.5.4 of the +then byt default ``[-Inf, Inf]`` is used.. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output @@ -297,7 +297,7 @@ end pow_rev2(b::Interval, c::Interval[, x::Interval]) Reverse power 2. Computes the preimage of ``c = aˣ`` with respect to `x`. If `x` is not provided, then -byt default ``[-∞, ∞]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. +byt default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output @@ -319,11 +319,11 @@ See section 10.5.5 of the IEEE 1788-2015 standard for interval arithmetic. ### Example ```jldoctest -julia> mul_rev_to_pair(-1..1, 1..2) -([-∞, -1], [1, ∞]) +julia> mul_rev_to_pair(-interval(1, 1), interval(1, 2)) +([-Inf, -1], [1, Inf]) -julia> mul_rev_to_pair(1..2, 3..4) -([1.5, 4], ∅) +julia> mul_rev_to_pair(interval(1, 2), interval(3, 4)) +([1.5, 4], emptyinterval()) """ mul_rev_to_pair(b::Interval, c::Interval) = extended_div(c, b) diff --git a/src/exponential.jl b/src/exponential.jl index 24b143c..2c373f9 100644 --- a/src/exponential.jl +++ b/src/exponential.jl @@ -11,7 +11,7 @@ end Reverse function for `exp`. """ function exp_rev(y::Interval, x::Interval) - y_new = y ⊓ (0..∞) + y_new = y ⊓ (interval(0, Inf)) x_new = x ⊓ log(y) return y_new, x_new end @@ -20,7 +20,7 @@ end Reverse function for `exp2`. """ function exp2_rev(y::Interval, x::Interval) - y_new = y ⊓ (0..∞) + y_new = y ⊓ (interval(0, Inf)) x_new = x ⊓ log2(y) return y_new, x_new @@ -30,7 +30,7 @@ end Reverse function for `exp10`. """ function exp10_rev(y::Interval, x::Interval) - y_new = y ⊓ (0..∞) + y_new = y ⊓ (interval(0, Inf)) x_new = x ⊓ log10(y) return y_new, x_new @@ -40,7 +40,7 @@ end Reverse function for `expm1`. """ function expm1_rev(y::Interval, x::Interval) - y_new = y ⊓ (-1.0..∞) + y_new = y ⊓ (interval(-1, Inf)) x_new = x ⊓ log1p(y) return y_new, x_new diff --git a/src/extrema.jl b/src/extrema.jl index a67ae3f..f08684e 100644 --- a/src/extrema.jl +++ b/src/extrema.jl @@ -12,10 +12,10 @@ function max_rev(a::Interval, b::Interval, c::Interval) # a = max(b,c) (sup(b) < sup(c)) && (C_hi = min(sup(c),sup(a))) if isempty_interval(b) - isempty_interval(c) && (return a, ∅, ∅) - return a, ∅, interval(C_lo,C_hi) + isempty_interval(c) && (return a, emptyinterval(), emptyinterval()) + return a, emptyinterval(), interval(C_lo,C_hi) else - isempty_interval(c) && (return a, interval(B_lo,B_hi), ∅) + isempty_interval(c) && (return a, interval(B_lo,B_hi), emptyinterval()) return a, interval(B_lo,B_hi), interval(C_lo,C_hi) end end @@ -35,10 +35,10 @@ function min_rev(a::Interval, b::Interval, c::Interval) (sup(b) < sup(c)) && (C_hi = min(sup(b),sup(a))) if isempty_interval(b) - isempty_interval(c) && (return a, ∅, ∅) - return a, ∅, interval(C_lo,C_hi) + isempty_interval(c) && (return a, emptyinterval(), emptyinterval()) + return a, emptyinterval(), interval(C_lo,C_hi) else - isempty_interval(c) && (return a, interval(B_lo,B_hi), ∅) + isempty_interval(c) && (return a, interval(B_lo,B_hi), emptyinterval()) return a, interval(B_lo,B_hi), interval(C_lo,C_hi) end end diff --git a/src/hyperbolic.jl b/src/hyperbolic.jl index 32a1f8b..53dcfcf 100644 --- a/src/hyperbolic.jl +++ b/src/hyperbolic.jl @@ -2,7 +2,7 @@ sinh_rev(c::Interval[, x::Interval]) Reverse hyperbolic sine. Calculates the preimage of `a = sinh(x)`. If `x` is not provided, then -byt default ``[-∞, ∞]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. +byt default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output @@ -21,7 +21,7 @@ end cosh_rev(c::Interval[, x::Interval]) Reverse square root. Calculates the preimage of `a = cosh(x)`. If `x` is not provided, then -byt default ``[-∞, ∞]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. +byt default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output @@ -31,7 +31,7 @@ The pair `(c, x_new)` where - `x_new` is the interval hull of the set ``{x ∈ b : cosh(x) ∈ a}`` """ function cosh_rev(y::Interval, x::Interval = entireinterval(y)) - y_new = y ⊓ interval(1.,∞) + y_new = y ⊓ interval(1.,Inf) x = (x ⊓ acosh(y)) ⊔ (x ⊓ -acosh(y)) return y_new, x @@ -41,7 +41,7 @@ end tanh_rev(c::Interval[, x::Interval]) Reverse square root. Calculates the preimage of `a = tanh(x)`. If `x` is not provided, then -byt default ``[-∞, ∞]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. +byt default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output diff --git a/src/inverse_hyperbolic.jl b/src/inverse_hyperbolic.jl index c0b5067..c8ae4d9 100644 --- a/src/inverse_hyperbolic.jl +++ b/src/inverse_hyperbolic.jl @@ -1,7 +1,7 @@ """ Reverse function for `asinh`. """ -function asinh_rev(y::Interval,x::Interval) +function asinh_rev(y::Interval, x::Interval = entireinterval(y)) x = x ⊓ sinh(y) return y, x @@ -10,8 +10,8 @@ end """ Reverse function for `acosh`. """ -function acosh_rev(y::Interval,x::Interval) - y_new = y ⊓ interval(0.0,∞) +function acosh_rev(y::Interval, x::Interval = entireinterval(y)) + y_new = y ⊓ interval(0.0,Inf) x = x ⊓ cosh(y) return y_new, x @@ -20,7 +20,7 @@ end """ Reverse function for `atanh`. """ -function atanh_rev(y::Interval,x::Interval) +function atanh_rev(y::Interval, x::Interval = entireinterval(y)) x = x ⊓ tanh(y) return y, x diff --git a/src/inverse_trig.jl b/src/inverse_trig.jl index 8238122..0b9680e 100644 --- a/src/inverse_trig.jl +++ b/src/inverse_trig.jl @@ -25,7 +25,7 @@ end Reverse `acos`. """ function acos_rev(y::Interval, x::Interval) - y_new = y ⊓ interval(0.0,sup(two_pi)) + y_new = y ⊓ interval(0.0, sup(two_pi)) x_new = x ⊓ cos(y_new) return y_new, x_new diff --git a/src/powers.jl b/src/powers.jl index ff907c4..1384e9b 100644 --- a/src/powers.jl +++ b/src/powers.jl @@ -11,7 +11,7 @@ function square_pos(X::IntervalBox) x, y = X - x = x ⊓ (0..∞) + x = x ⊓ (interval(0, Inf)) y = y ⊓ (x^2) x = x ⊓ √y @@ -27,7 +27,7 @@ function cube_pos(X::IntervalBox) # contractor for y=x^3, x>=0 x, y = X - x = x ⊓ (0..∞) + x = x ⊓ (interval(0, Inf)) y = y ⊓ (x ^ 3) x = x ⊓ interval(inf(y) ^ (1/3), sup(y)^(1/3)) # not rigorous! diff --git a/src/transformations.jl b/src/transformations.jl index 2eedad6..fb35b0c 100644 --- a/src/transformations.jl +++ b/src/transformations.jl @@ -68,15 +68,15 @@ function periodise(C, period) X -> begin x, y = X - x2 = -∞..∞ + x2 = entireinterval() x2, y = C(IntervalBox(x2, y)) - isempty(IntervalBox(x2, y)) && return(IntervalBox(∅, ∅)) + isempty(IntervalBox(x2, y)) && return(IntervalBox(emptyinterval(), emptyinterval())) # periods where the periodization of x intersects with x2: periods = integer_contractor((x - x2) / period) - isempty_interval(periods) && return(IntervalBox(∅, ∅)) + isempty_interval(periods) && return(IntervalBox(emptyinterval(), emptyinterval())) x3 = x2 + periods*period x = x ⊓ x3 diff --git a/src/trig.jl b/src/trig.jl index 962b3da..5a528ec 100644 --- a/src/trig.jl +++ b/src/trig.jl @@ -9,7 +9,7 @@ function sin_main(X::IntervalBox) x, y = X x_range = interval(-sup(half_pi), sup(half_pi)) - y_range = -1..1 + y_range = interval(-1, 1) x = x ⊓ x_range y = y ⊓ y_range @@ -40,7 +40,7 @@ sin!(X::IntervalBox) = periodise(sin_main, two_pi)(X) ⊔ periodise(sin_reverse, sin_rev(c::Interval[, x::Interval]) Reverse sine. Calculates the preimage of `a = sin(x)`. If `x` is not provided, then -byt default ``[-∞, ∞]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. +byt default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output @@ -68,7 +68,7 @@ function cos_main(X::IntervalBox) x, y = X x_range = interval(0, inf(interval(π))) - y_range = -1..1 + y_range = interval(-1, 1) x = x ⊓ x_range y = y ⊓ y_range @@ -100,7 +100,7 @@ cos!(X::IntervalBox) = periodise(cos_main, two_pi)(X) ⊔ periodise(cos_reverse, cos_rev(c::Interval[, x::Interval]) Reverse cosine. Calculates the preimage of `a = cos(x)`. If `x` is not provided, then -byt default ``[-∞, ∞]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. +byt default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output @@ -145,7 +145,7 @@ tan!(X::IntervalBox) = periodise(tan_main, interval(π))(X) tan_rev(c::Interval[, x::Interval]) Reverse tangent. Calculates the preimage of `a = tan(x)`. If `x` is not provided, then -byt default ``[-∞, ∞]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. +byt default ``[-Inf, Inf]`` is used. See section 10.5.4 of the IEEE 1788-2015 standard for interval arithmetic. ### Output diff --git a/test/Non1788tests/exponential.jl b/test/Non1788tests/exponential.jl index a947f9b..36f27ae 100644 --- a/test/Non1788tests/exponential.jl +++ b/test/Non1788tests/exponential.jl @@ -1,74 +1,66 @@ -#Test library imports using Test -#Arithmetic library imports using IntervalArithmetic using IntervalContractors -#Preamble -setprecision(53) -setprecision(Interval, Float64) - -# Using approximate checks for validaty update later? -import Base.isapprox -isapprox(x::Interval,y::Interval) = isapprox(inf(x),inf(y),atol=1E-4) && isapprox(sup(x),sup(y),atol=1E-4) +# Using approximate checks for validity update later? @testset "exp2_rev_test" begin - @test isequal_interval(exp2_rev(∅, entireinterval(Float64))[2], ∅) - @test isequal_interval(exp2_rev(interval(0.0, 1.0), ∅)[2], ∅) - @test isequal_interval(exp2_rev(∅, interval(0.0, 1.0))[2], ∅) - @test isequal_interval(exp2_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], ∅) - @test isequal_interval(exp2_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(0.0, 0.0)) - @test isequal_interval(exp2_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-∞, ∞)) - @test isequal_interval(exp2_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], ∅) + @test eq(exp2_rev(emptyinterval(), entireinterval(Float64))[2], emptyinterval()) + @test eq(exp2_rev(interval(0.0, 1.0), emptyinterval())[2], emptyinterval()) + @test eq(exp2_rev(emptyinterval(), interval(0.0, 1.0))[2], emptyinterval()) + @test eq(exp2_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], emptyinterval()) + @test eq(exp2_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(0.0, 0.0)) + @test eq(exp2_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-Inf, Inf)) + @test eq(exp2_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], emptyinterval()) end @testset "exp10_rev_test" begin - @test isequal_interval(exp10_rev(∅, entireinterval(Float64))[2], ∅) - @test isequal_interval(exp10_rev(interval(0.0, 1.0), ∅)[2], ∅) - @test isequal_interval(exp10_rev(∅, interval(0.0, 1.0))[2], ∅) - @test isequal_interval(exp10_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], ∅) - @test isequal_interval(exp10_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(0.0, 0.0)) - @test isequal_interval(exp10_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-∞, ∞)) - @test isequal_interval(exp10_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], ∅) + @test eq(exp10_rev(emptyinterval(), entireinterval(Float64))[2], emptyinterval()) + @test eq(exp10_rev(interval(0.0, 1.0), emptyinterval())[2], emptyinterval()) + @test eq(exp10_rev(emptyinterval(), interval(0.0, 1.0))[2], emptyinterval()) + @test eq(exp10_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], emptyinterval()) + @test eq(exp10_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(0.0, 0.0)) + @test eq(exp10_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-Inf, Inf)) + @test eq(exp10_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], emptyinterval()) end @testset "expm1_rev_test" begin - @test isequal_interval(expm1_rev(∅, entireinterval(Float64))[2], ∅) - @test isequal_interval(expm1_rev(interval(0.0, 1.0), ∅)[2], ∅) - @test isequal_interval(expm1_rev(∅, interval(0.0, 1.0))[2], ∅) - @test isequal_interval(expm1_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], ∅) - @test isapprox(expm1_rev(interval(1.0, 1.0), entireinterval(Float64))[2],interval(0.693147, 0.693148)) - @test isequal_interval(expm1_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-∞, ∞)) - @test isequal_interval(expm1_rev(interval(-Inf, -1.0), entireinterval(Float64))[2], ∅) + @test eq(expm1_rev(emptyinterval(), entireinterval(Float64))[2], emptyinterval()) + @test eq(expm1_rev(interval(0.0, 1.0), emptyinterval())[2], emptyinterval()) + @test eq(expm1_rev(emptyinterval(), interval(0.0, 1.0))[2], emptyinterval()) + @test eq(expm1_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], emptyinterval()) + @test approx_eq(expm1_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(0.693147, 0.693148)) + @test eq(expm1_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-Inf, Inf)) + @test eq(expm1_rev(interval(-Inf, -1.0), entireinterval(Float64))[2], emptyinterval()) end @testset "log2_rev_test" begin - @test isequal_interval(log2_rev(∅, entireinterval(Float64))[2], ∅) - @test isequal_interval(log2_rev(interval(0.0, 1.0), ∅)[2], ∅) - @test isequal_interval(log2_rev(∅, interval(0.0, 1.0))[2], ∅) - @test isequal_interval(log2_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], interval(0.25, 0.5)) - @test isequal_interval(log2_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(2.0, 2.0)) - @test isequal_interval(log2_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(0.0, Inf)) - @test isequal_interval(log2_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(0.0, 1.0)) + @test eq(log2_rev(emptyinterval(), entireinterval(Float64))[2], emptyinterval()) + @test eq(log2_rev(interval(0.0, 1.0), emptyinterval())[2], emptyinterval()) + @test eq(log2_rev(emptyinterval(), interval(0.0, 1.0))[2], emptyinterval()) + @test eq(log2_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], interval(0.25, 0.5)) + @test eq(log2_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(2.0, 2.0)) + @test eq(log2_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(0.0, Inf)) + @test eq(log2_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(0.0, 1.0)) end @testset "log10_rev_test" begin - @test isequal_interval(log10_rev(∅, entireinterval(Float64))[2], ∅) - @test isequal_interval(log10_rev(interval(0.0, 1.0), ∅)[2], ∅) - @test isequal_interval(log10_rev(∅, interval(0.0, 1.0))[2], ∅) - @test isapprox(log10_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], interval(0.00999999, 0.100001)) - @test isequal_interval(log10_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(10.0, 10.0)) - @test isequal_interval(log10_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(0.0, Inf)) - @test isequal_interval(log10_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(0.0, 1.0)) + @test eq(log10_rev(emptyinterval(), entireinterval(Float64))[2], emptyinterval()) + @test eq(log10_rev(interval(0.0, 1.0), emptyinterval())[2], emptyinterval()) + @test eq(log10_rev(emptyinterval(), interval(0.0, 1.0))[2], emptyinterval()) + @test approx_eq(log10_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], interval(0.00999999, 0.100001)) + @test eq(log10_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(10.0, 10.0)) + @test eq(log10_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(0.0, Inf)) + @test eq(log10_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(0.0, 1.0)) end @testset "log1p_rev_test" begin - @test isequal_interval(log1p_rev(∅, entireinterval(Float64))[2], ∅) - @test isequal_interval(log1p_rev(interval(0.0, 1.0), ∅)[2], ∅) - @test isequal_interval(log1p_rev(∅, interval(0.0, 1.0))[2], ∅) - @test isapprox(log1p_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], interval(-0.864665, -0.63212)) - @test isapprox(log1p_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(1.71828, 1.71829)) - @test isequal_interval(log1p_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-1.0, Inf)) - @test isequal_interval(log1p_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(-1.0, 0.0)) + @test eq(log1p_rev(emptyinterval(), entireinterval(Float64))[2], emptyinterval()) + @test eq(log1p_rev(interval(0.0, 1.0), emptyinterval())[2], emptyinterval()) + @test eq(log1p_rev(emptyinterval(), interval(0.0, 1.0))[2], emptyinterval()) + @test approx_eq(log1p_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], interval(-0.864665, -0.63212)) + @test approx_eq(log1p_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(1.71828, 1.71829)) + @test eq(log1p_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-1.0, Inf)) + @test eq(log1p_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(-1.0, 0.0)) end diff --git a/test/Non1788tests/extrema.jl b/test/Non1788tests/extrema.jl index abc816d..3df56a0 100644 --- a/test/Non1788tests/extrema.jl +++ b/test/Non1788tests/extrema.jl @@ -1,33 +1,25 @@ using Test -#Arithmetic library imports +# Arithmetic library imports using IntervalArithmetic using IntervalContractors -#Preamble -setprecision(53) -setprecision(Interval, Float64) - -# Using approximate checks for validaty update later? -import Base.isapprox -isapprox(x::Interval,y::Interval) = isapprox(inf(x),inf(y),atol=1E-4) && isapprox(sup(x),sup(y),atol=1E-4) - @testset "max_rev_test" begin - @test isequal_interval(max_rev(∅, entireinterval(Float64),entireinterval(Float64))[2], interval(-∞, ∞)) - @test isequal_interval(max_rev(interval(0.0, 1.0), ∅,interval(-2.0, -1.0))[2], ∅) - @test isequal_interval(max_rev(∅, interval(0.0, 1.0),interval(-2.0, -1.0))[2], ∅) - @test isequal_interval(max_rev(interval(-2.0, -1.0), entireinterval(Float64),interval(-3.0, -2.0))[2], interval(-∞, -1.0)) - @test isapprox(max_rev(interval(1.0, 1.0), entireinterval(Float64),interval(-2.0, -1.0))[2], interval(-∞, 1)) - @test isequal_interval(max_rev(entireinterval(Float64), interval(-2.0, -1.0), interval(-3.0, -2.0))[2], interval(-2.0, -1.0)) - @test isequal_interval(max_rev(interval(-Inf, 0.0), entireinterval(Float64),interval(-3.0, -2.0))[2], interval(-∞, 0.0)) + @test eq(max_rev(emptyinterval(), entireinterval(Float64),entireinterval(Float64))[2], interval(-Inf, Inf)) + @test eq(max_rev(interval(0.0, 1.0), emptyinterval(),interval(-2.0, -1.0))[2], emptyinterval()) + @test eq(max_rev(emptyinterval(), interval(0.0, 1.0),interval(-2.0, -1.0))[2], emptyinterval()) + @test eq(max_rev(interval(-2.0, -1.0), entireinterval(Float64),interval(-3.0, -2.0))[2], interval(-Inf, -1.0)) + @test approx_eq(max_rev(interval(1.0, 1.0), entireinterval(Float64),interval(-2.0, -1.0))[2], interval(-Inf, 1)) + @test eq(max_rev(entireinterval(Float64), interval(-2.0, -1.0), interval(-3.0, -2.0))[2], interval(-2.0, -1.0)) + @test eq(max_rev(interval(-Inf, 0.0), entireinterval(Float64),interval(-3.0, -2.0))[2], interval(-Inf, 0.0)) end @testset "min_rev_test" begin - @test isequal_interval(min_rev(∅, entireinterval(Float64),entireinterval(Float64))[2], interval(-∞, ∞)) - @test isequal_interval(min_rev(interval(0.0, 1.0), ∅,interval(-2.0, -1.0))[2], ∅ # should return empty?) - @test isequal_interval(min_rev(∅, interval(0.0, 1.0),interval(-2.0, -1.0))[2], ∅) - @test isequal_interval(min_rev(interval(-2.0, -1.0), entireinterval(Float64),interval(-3.0, -2.0))[2], interval(-∞, -2.0)) - @test isapprox(min_rev(interval(1.0, 1.0), entireinterval(Float64),interval(-2.0, -1.0))[2], interval(-∞, -1.0)) - @test isequal_interval(min_rev(entireinterval(Float64), interval(-2.0, -1.0), interval(-3.0, -2.0))[2], interval(-3.0, -2.0)) - @test isequal_interval(min_rev(interval(-Inf, 0.0), entireinterval(Float64),interval(-3.0, -2.0))[2], interval(-∞, -2.0)) + @test eq(min_rev(emptyinterval(), entireinterval(Float64),entireinterval(Float64))[2], interval(-Inf, Inf)) + @test eq(min_rev(interval(0.0, 1.0), emptyinterval(), interval(-2.0, -1.0))[2], emptyinterval()) # should return empty?) + @test eq(min_rev(emptyinterval(), interval(0.0, 1.0),interval(-2.0, -1.0))[2], emptyinterval()) + @test eq(min_rev(interval(-2.0, -1.0), entireinterval(Float64),interval(-3.0, -2.0))[2], interval(-Inf, -2.0)) + @test approx_eq(min_rev(interval(1.0, 1.0), entireinterval(Float64),interval(-2.0, -1.0))[2], interval(-Inf, -1.0)) + @test eq(min_rev(entireinterval(Float64), interval(-2.0, -1.0), interval(-3.0, -2.0))[2], interval(-3.0, -2.0)) + @test eq(min_rev(interval(-Inf, 0.0), entireinterval(Float64),interval(-3.0, -2.0))[2], interval(-Inf, -2.0)) end diff --git a/test/Non1788tests/hyperbolic.jl b/test/Non1788tests/hyperbolic.jl index aa7a99d..4fbb8eb 100644 --- a/test/Non1788tests/hyperbolic.jl +++ b/test/Non1788tests/hyperbolic.jl @@ -5,32 +5,24 @@ using Test using IntervalArithmetic using IntervalContractors -#Preamble -setprecision(53) -setprecision(Interval, Float64) - -# Using approximate checks for validaty update later? -import Base.isapprox -isapprox(x::Interval,y::Interval) = isapprox(inf(x),inf(y),atol=1E-4) && isapprox(sup(x),sup(y),atol=1E-4) - @testset "sinh_rev_test" begin - @test isapprox(sinh_rev(∅, -∞..∞)[2], ∅) - @test isapprox(sinh_rev(interval(-10.0, -1.0), -∞..∞)[2], interval(-2.99823, -0.881373)) - @test isapprox(sinh_rev(interval(0.0, Inf), -∞..∞)[2], interval(0.0, ∞)) - @test isapprox(sinh_rev(interval(0.0, 1.0), -∞..∞)[2], interval(0, 0.881374)) - @test isapprox(sinh_rev(interval(-0.5, 1.0), -∞..∞)[2], interval(-0.481212, 0.881374)) - @test isapprox(sinh_rev(interval(-1000.0, 1.0), -∞..∞)[2], interval(-7.60091, 0.881374)) - @test isapprox(sinh_rev(interval(0.0, 25.0), -∞..∞)[2], interval(0.0, 3.91243)) - @test isapprox(sinh_rev(interval(-1.0, 25.0), -∞..∞)[2], interval(-0.881374, 3.91243)) + @test approx_eq(sinh_rev(emptyinterval(), entireinterval())[2], emptyinterval()) + @test approx_eq(sinh_rev(interval(-10.0, -1.0), entireinterval())[2], interval(-2.99823, -0.881373)) + @test approx_eq(sinh_rev(interval(0.0, Inf), entireinterval())[2], interval(0.0, Inf)) + @test approx_eq(sinh_rev(interval(0.0, 1.0), entireinterval())[2], interval(0, 0.881374)) + @test approx_eq(sinh_rev(interval(-0.5, 1.0), entireinterval())[2], interval(-0.481212, 0.881374)) + @test approx_eq(sinh_rev(interval(-1000.0, 1.0), entireinterval())[2], interval(-7.60091, 0.881374)) + @test approx_eq(sinh_rev(interval(0.0, 25.0), entireinterval())[2], interval(0.0, 3.91243)) + @test approx_eq(sinh_rev(interval(-1.0, 25.0), entireinterval())[2], interval(-0.881374, 3.91243)) end @testset "tanh_rev_test" begin - @test isequal_interval(tanh_rev(∅, -∞..∞)[2], ∅) - @test isequal_interval(tanh_rev(interval(-10.0, -1.0), -∞..∞)[2], ∅) - @test isapprox(tanh_rev(interval(0.0, Inf), -∞..∞)[2], interval(0.0, ∞)) - @test isapprox(tanh_rev(interval(0.0, 1.0), -∞..∞)[2], interval(0.0, ∞)) - @test isapprox(tanh_rev(interval(-0.5, 1.0), -∞..∞)[2], interval(-0.549307, ∞)) - @test isapprox(tanh_rev(interval(-1000.0, 1.0), -∞..∞)[2], interval(-∞, ∞)) - @test isapprox(tanh_rev(interval(0.0, 25.0), -∞..∞)[2], interval(0, ∞)) - @test isapprox(tanh_rev(interval(-1.0, 25.0), -∞..∞)[2], interval(-∞, ∞)) + @test eq(tanh_rev(emptyinterval(), entireinterval())[2], emptyinterval()) + @test eq(tanh_rev(interval(-10.0, -1.0), entireinterval())[2], emptyinterval()) + @test approx_eq(tanh_rev(interval(0.0, Inf), entireinterval())[2], interval(0.0, Inf)) + @test approx_eq(tanh_rev(interval(0.0, 1.0), entireinterval())[2], interval(0.0, Inf)) + @test approx_eq(tanh_rev(interval(-0.5, 1.0), entireinterval())[2], interval(-0.549307, Inf)) + @test approx_eq(tanh_rev(interval(-1000.0, 1.0), entireinterval())[2], interval(-Inf, Inf)) + @test approx_eq(tanh_rev(interval(0.0, 25.0), entireinterval())[2], interval(0, Inf)) + @test approx_eq(tanh_rev(interval(-1.0, 25.0), entireinterval())[2], interval(-Inf, Inf)) end diff --git a/test/Non1788tests/inv_hyperbolic.jl b/test/Non1788tests/inv_hyperbolic.jl index d9c8228..54369be 100644 --- a/test/Non1788tests/inv_hyperbolic.jl +++ b/test/Non1788tests/inv_hyperbolic.jl @@ -5,37 +5,29 @@ using Test using IntervalArithmetic using IntervalContractors -#Preamble -setprecision(53) -setprecision(Interval, Float64) - -# Using approximate checks for validaty update later? -import Base.isapprox -isapprox(x::Interval,y::Interval) = isapprox(inf(x),inf(y),atol=1E-4) && isapprox(sup(x),sup(y),atol=1E-4) - @testset "asinh_rev_test" begin - @test isequal_interval(asinh_rev(∅, -∞..∞)[2], ∅) - @test isapprox(asinh_rev(interval(0.0, Inf), -∞..∞)[2], interval(0.0, ∞)) - @test isapprox(asinh_rev(interval(0.0, 1.0), -∞..∞)[2], interval(0, 1.17521)) - @test isapprox(asinh_rev(interval(-0.5, 1.0), -∞..∞)[2], interval(-0.521096, 1.17521)) - @test isapprox(asinh_rev(interval(-1000.0, 1.0), -∞..∞)[2], interval(-∞, 1.17521)) + @test eq(asinh_rev(emptyinterval(), entireinterval())[2], emptyinterval()) + @test approx_eq(asinh_rev(interval(0.0, Inf), entireinterval())[2], interval(0.0, Inf)) + @test approx_eq(asinh_rev(interval(0.0, 1.0), entireinterval())[2], interval(0, 1.17521)) + @test approx_eq(asinh_rev(interval(-0.5, 1.0), entireinterval())[2], interval(-0.521096, 1.17521)) + @test approx_eq(asinh_rev(interval(-1000.0, 1.0), entireinterval())[2], interval(-Inf, 1.17521)) end @testset "acosh_rev_test" begin - @test isequal_interval(acosh_rev(∅, -∞..∞)[2], ∅) - @test isequal_interval(acosh_rev(interval(0.0, Inf), -∞..∞)[2], interval(1.0, ∞)) - @test isapprox(acosh_rev(interval(0.0, 1.0), -∞..∞)[2], interval(1.0, 1.54309)) - @test isapprox(acosh_rev(interval(-0.5, 1.0), -∞..∞)[2], interval(1.0, 1.54309)) - @test isequal_interval(acosh_rev(interval(-1000.0, 1.0), -∞..∞)[2], interval(1.0, ∞)) + @test eq(acosh_rev(emptyinterval(), entireinterval())[2], emptyinterval()) + @test eq(acosh_rev(interval(0.0, Inf), entireinterval())[2], interval(1.0, Inf)) + @test approx_eq(acosh_rev(interval(0.0, 1.0), entireinterval())[2], interval(1.0, 1.54309)) + @test approx_eq(acosh_rev(interval(-0.5, 1.0), entireinterval())[2], interval(1.0, 1.54309)) + @test eq(acosh_rev(interval(-1000.0, 1.0), entireinterval())[2], interval(1.0, Inf)) end @testset "atanh_rev_test" begin - @test isequal_interval(atanh_rev(∅, -∞..∞)[2], ∅) - @test isapprox(atanh_rev(interval(-10.0, -1.0), -∞..∞)[2], interval(-1, -0.761594)) - @test isequal_interval(atanh_rev(interval(0.0, Inf), -∞..∞)[2], interval(0, 1)) - @test isapprox(atanh_rev(interval(0.0, 1.0), -∞..∞)[2], interval(0, 0.761595)) - @test isapprox(atanh_rev(interval(-0.5, 1.0), -∞..∞)[2], interval(-0.462118, 0.761595)) - @test isapprox(atanh_rev(interval(-1000.0, 1.0), -∞..∞)[2], interval(-1, 0.761595)) - @test isequal_interval(atanh_rev(interval(0.0, 25.0), -∞..∞)[2], interval(0, 1)) - @test isapprox(atanh_rev(interval(-1.0, 25.0), -∞..∞)[2], interval(-0.761595, 1)) + @test eq(atanh_rev(emptyinterval(), entireinterval())[2], emptyinterval()) + @test approx_eq(atanh_rev(interval(-10.0, -1.0), entireinterval())[2], interval(-1, -0.761594)) + @test eq(atanh_rev(interval(0.0, Inf), entireinterval())[2], interval(0, 1)) + @test approx_eq(atanh_rev(interval(0.0, 1.0), entireinterval())[2], interval(0, 0.761595)) + @test approx_eq(atanh_rev(interval(-0.5, 1.0), entireinterval())[2], interval(-0.462118, 0.761595)) + @test approx_eq(atanh_rev(interval(-1000.0, 1.0), entireinterval())[2], interval(-1, 0.761595)) + @test eq(atanh_rev(interval(0.0, 25.0), entireinterval())[2], interval(0, 1)) + @test approx_eq(atanh_rev(interval(-1.0, 25.0), entireinterval())[2], interval(-0.761595, 1)) end diff --git a/test/Non1788tests/inv_rev.jl b/test/Non1788tests/inv_rev.jl index 7a9c8a7..33cda09 100644 --- a/test/Non1788tests/inv_rev.jl +++ b/test/Non1788tests/inv_rev.jl @@ -6,20 +6,12 @@ using Test using IntervalArithmetic using IntervalContractors -#Preamble -setprecision(53) -setprecision(Interval, Float64) - -# Using approximate checks for validaty update later? -import Base.isapprox -isapprox(x::Interval,y::Interval) = isapprox(inf(x),inf(y),atol=1E-4) && isapprox(sup(x),sup(y),atol=1E-4) - @testset "inv_rev_test" begin - @test isequal_interval(inv_rev(∅, entireinterval(Float64))[2], ∅) - @test isequal_interval(inv_rev(interval(0.0, 1.0), ∅)[2], ∅) - @test isequal_interval(inv_rev(∅, interval(0.0, 1.0))[2], ∅) - @test isequal_interval(inv_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], interval(-1.0, -0.5)) - @test isequal_interval(inv_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(1.0, 1.0)) - @test isequal_interval(inv_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-∞, ∞)) - @test isequal_interval(inv_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(-∞, 0.0)) + @test eq(inv_rev(emptyinterval(), entireinterval(Float64))[2], emptyinterval()) + @test eq(inv_rev(interval(0.0, 1.0), emptyinterval())[2], emptyinterval()) + @test eq(inv_rev(emptyinterval(), interval(0.0, 1.0))[2], emptyinterval()) + @test eq(inv_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], interval(-1.0, -0.5)) + @test eq(inv_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(1.0, 1.0)) + @test eq(inv_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-Inf, Inf)) + @test eq(inv_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(-Inf, 0.0)) end diff --git a/test/Non1788tests/inv_trig.jl b/test/Non1788tests/inv_trig.jl index b7a3911..92d068a 100644 --- a/test/Non1788tests/inv_trig.jl +++ b/test/Non1788tests/inv_trig.jl @@ -6,29 +6,21 @@ using Test using IntervalArithmetic using IntervalContractors -#Preamble -setprecision(53) -setprecision(Interval, Float64) - -# Using approximate checks for validaty update later? -import Base.isapprox -isapprox(x::Interval,y::Interval) = isapprox(inf(x),inf(y),atol=1E-4) && isapprox(sup(x),sup(y),atol=1E-4) - @testset "acos_rev_test" begin - @test isequal_interval(acos_rev(∅, entireinterval(Float64))[2], ∅) - @test isequal_interval(acos_rev(interval(0.0, 1.0), ∅)[2], ∅) - @test isequal_interval(acos_rev(∅, interval(0.0, 1.0))[2], ∅) - @test isequal_interval(acos_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], ∅) - @test isapprox(acos_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(0.540302, 0.540303)) - @test isequal_interval(acos_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-1.0, 1.0)) - @test isequal_interval(acos_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(1.0, 1.0)) + @test eq(acos_rev(emptyinterval(), entireinterval(Float64))[2], emptyinterval()) + @test eq(acos_rev(interval(0.0, 1.0), emptyinterval())[2], emptyinterval()) + @test eq(acos_rev(emptyinterval(), interval(0.0, 1.0))[2], emptyinterval()) + @test eq(acos_rev(interval(-2.0, -1.0), entireinterval(Float64))[2], emptyinterval()) + @test approx_eq(acos_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(0.540302, 0.540303)) + @test eq(acos_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-1.0, 1.0)) + @test eq(acos_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(1.0, 1.0)) end @testset "atan_rev_test" begin - @test isequal_interval(atan_rev(∅, entireinterval(Float64))[2], ∅) - @test isequal_interval(atan_rev(interval(0.0, 1.0), ∅)[2], ∅) - @test isequal_interval(atan_rev(∅, interval(0.0, 1.0))[2], ∅) - @test isapprox(atan_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(1.5574, 1.55741)) - @test isequal_interval(atan_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-∞, ∞)) - @test isequal_interval(atan_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(-∞, ∞)) + @test eq(atan_rev(emptyinterval(), entireinterval(Float64))[2], emptyinterval()) + @test eq(atan_rev(interval(0.0, 1.0), emptyinterval())[2], emptyinterval()) + @test eq(atan_rev(emptyinterval(), interval(0.0, 1.0))[2], emptyinterval()) + @test approx_eq(atan_rev(interval(1.0, 1.0), entireinterval(Float64))[2], interval(1.5574, 1.55741)) + @test eq(atan_rev(entireinterval(Float64), entireinterval(Float64))[2], interval(-Inf, Inf)) + @test eq(atan_rev(interval(-Inf, 0.0), entireinterval(Float64))[2], interval(-Inf, Inf)) end diff --git a/test/Non1788tests/script.jl b/test/Non1788tests/script.jl index 2cda868..ed1b885 100644 --- a/test/Non1788tests/script.jl +++ b/test/Non1788tests/script.jl @@ -1,19 +1,8 @@ -#workspace() - using Test -#Arithmetic library imports using IntervalArithmetic using IntervalContractors -#Preamble -setprecision(53) -setprecision(Interval, Float64) - -# Using approximate checks for validaty update later? -import Base.isapprox -isapprox(x::Interval,y::Interval) = isapprox(inf(x),inf(y),atol=1E-4) && isapprox(sup(x),sup(y),atol=1E-4) - -c = ∅ +c = emptyinterval() d = entireinterval(Float64) a,b = exp2_rev(c, d) diff --git a/test/runtests.jl b/test/runtests.jl index 36e03f5..edc9a05 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,7 +2,15 @@ using IntervalContractors using IntervalArithmetic using Test +# cache current power mode: +orig_power_mode = IntervalArithmetic.power_mode() + +# set power mode to "slow" (using MPFR for correct rounding): +IntervalArithmetic.power_mode() = IntervalArithmetic.PowerMode{:slow}() + eq(a, b) = isequal_interval(bareinterval(a), bareinterval(b)) +approx_eq(x::Interval, y::Interval) = + isapprox(inf(x), inf(y), atol=1e-4) && isapprox(sup(x), sup(y), atol=1e-4) @testset "IntervalContractors tests" begin include("abs_rev.jl") @@ -12,20 +20,23 @@ eq(a, b) = isequal_interval(bareinterval(a), bareinterval(b)) include("Non1788tests.jl") @testset "power_rev for odd power" begin - x = -∞..∞ - a = -8..27 - @test eq(power_rev(a, x, 3)[2], interval(-2.0000000000000004, 3.0000000000000004)) + x = entireinterval() + a = interval(-8, 27) + @test eq(power_rev(a, x, 3)[2], interval(-2, 3)) end @testset "mul_rev with sets straddling 0" begin - x = -1..5 - y = -1..1 - z = 2..10 + x = interval(-1, 5) + y = interval(-1, 1) + z = interval(2, 10) - @test isequal_interval.(mul_rev(z, x, y), (2..10, 2..5, 0.4..1.0)) + @test all(eq.(mul_rev(z, x, y), (interval(2, 10), interval(2, 5), interval(0.39999999999999997, 1)))) end @testset "Exponents with integer values but not types" begin - @test isequal_interval.(power_rev(-Inf..Inf, -4..4, 2.0), (-∞..∞, -4..4, 2.0)) + @test all(eq.(power_rev(entireinterval(), -interval(4, 4), 2.0), (entireinterval(), interval(-4, -4), 2.0))) end end + +# reset power mode: +IntervalArithmetic.power_mode() = orig_power_mode