From 49c8ee4a4a73cb756db606527cfb866cbe9f4cf5 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Sat, 23 Feb 2019 08:25:12 -0600 Subject: [PATCH] Fix rounding in ^ --- src/intervals/functions.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intervals/functions.jl b/src/intervals/functions.jl index 6d2b51de3..b8a371abc 100644 --- a/src/intervals/functions.jl +++ b/src/intervals/functions.jl @@ -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