Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/aff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,34 @@ function Base.inv(x::Aff, X=interval(x))

return affine_approx(x, α, ζ, δ)
end


function Base.exp(x::Aff, X=interval(x))

# min-range approximation: de Figuereido book, pg. 69

a, b = X.lo, X.hi

# @show a, b

exp_X = exp(X)
exp_a, exp_b = exp_X.lo, exp_X.hi

α = exp_a

if α == 0
d_min = zero(x.lo)
d_max = exp_b

else
d_max = IntervalArithmetic.@round_up(exp_b - α*b)
d_min = IntervalArithmetic.@round_down(exp_a - α*a)
end

d = interval(d_min, d_max)

ζ = mid(d)
δ = radius(d) * (-1..1)

return affine_approx(x, α, ζ, δ)
end
4 changes: 2 additions & 2 deletions src/affine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import IntervalArithmetic: interval

using LinearAlgebra

import Base: +, *, ^, -, sqrt, inv
import Base: +, *, ^, -, sqrt, inv, exp

"""
Affine form with center `c`, affine components `γ` and error `Δ`.
Expand Down Expand Up @@ -56,7 +56,7 @@ for op in (:+, :*, :-)
end
end

for op in (:sqrt, :inv)
for op in (:sqrt, :inv, :exp)
@eval function $op(x::Affine)
affine = $op(x.affine, x.range)

Expand Down