Skip to content

Commit

Permalink
Fix pow
Browse files Browse the repository at this point in the history
  • Loading branch information
dpsanders committed Sep 17, 2018
1 parent be4e2f0 commit 9368780
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/intervals/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/multidim/intervalbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 9368780

Please sign in to comment.