Skip to content

Commit

Permalink
Fix rounding in ^
Browse files Browse the repository at this point in the history
  • Loading branch information
dpsanders committed May 22, 2019
1 parent da493b5 commit 49c8ee4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/intervals/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ function ^(x::Interval, n::Integer) # fast integer power
power_by_squaring(mag(x), n, RoundUp))

elseif x.lo > 0
return Interval(power_by_squaring(x.lo, n, RoundUp),
return Interval(power_by_squaring(x.lo, n, RoundDown),
power_by_squaring(x.hi, n, RoundUp))

else # x.lo < x.hi < 0
return Interval(power_by_squaring(-x.hi, n, RoundUp),
return Interval(power_by_squaring(-x.hi, n, RoundDown),
power_by_squaring(-x.lo, n, RoundUp))
end

Expand Down

0 comments on commit 49c8ee4

Please sign in to comment.