diff --git a/src/intervals/functions.jl b/src/intervals/functions.jl index 5c38dd4f8..745d05daa 100644 --- a/src/intervals/functions.jl +++ b/src/intervals/functions.jl @@ -211,9 +211,12 @@ function pow(x::Interval, n::Integer) # fast integer power else - return Interval(power_by_squaring(x.lo, n, RoundDown), - power_by_squaring(x.hi, n, RoundUp)) + a = power_by_squaring(x.lo, n, RoundDown) + b = power_by_squaring(x.hi, n, RoundUp) + (a <= b) && return Interval(a, b) + + return Interval(b, a) end end diff --git a/src/multidim/intervalbox.jl b/src/multidim/intervalbox.jl index 9cdf8cc67..eedb45ce3 100644 --- a/src/multidim/intervalbox.jl +++ b/src/multidim/intervalbox.jl @@ -50,8 +50,8 @@ Return a vector of the `mid` of each interval composing the `IntervalBox`. See `mid(X::Interval, α=0.5)` for more informations. """ -mid(X::IntervalBox) = mid.(X.v) -mid(X::IntervalBox, α) = mid.(X.v, α) +mid(X::IntervalBox) = mid.(X) +mid(X::IntervalBox, α) = mid.(X, α) big(X::IntervalBox) = big.(X)