Skip to content

Commit

Permalink
Merge pull request #638 from Kolaru/compat_rootfinding
Browse files Browse the repository at this point in the history
Small fixes for ExactReal
  • Loading branch information
Kolaru committed Apr 22, 2024
2 parents 79ab4a4 + c89777c commit 7ec07bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ext/IntervalArithmeticForwardDiffExt.jl
Expand Up @@ -48,4 +48,12 @@ function Base.:(^)(x::Interval, y::Dual{Ty, <:Interval}) where Ty
return Dual{Ty}(expv, deriv * partials(y))
end

function Base.:(^)(x::Dual{<:Any, I}, y::ExactReal) where I<:Interval
return x^convert(I, y)
end

function Base.:(^)(x::ExactReal, y::Dual{<:Any, I}) where I<:Interval
return convert(I, x)^y
end

end
1 change: 1 addition & 0 deletions src/intervals/exact_literals.jl
Expand Up @@ -54,6 +54,7 @@ struct ExactReal{T<:Real} <: Real
end

_value(x::ExactReal) = x.value # hook for interval constructor
Base.to_index(i::ExactReal{<:Integer}) = i.value # allow to index with ExactReal

# conversion and promotion

Expand Down

0 comments on commit 7ec07bc

Please sign in to comment.