From 2c466d27bc1bd301c6b16c27071808dc1dd19ecf Mon Sep 17 00:00:00 2001 From: Luis Benet Date: Mon, 14 Oct 2024 16:03:16 -0600 Subject: [PATCH] Add Dual(x::ExactReal) --- ext/IntervalArithmeticForwardDiffExt.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/IntervalArithmeticForwardDiffExt.jl b/ext/IntervalArithmeticForwardDiffExt.jl index bffa6cc8..793435b0 100644 --- a/ext/IntervalArithmeticForwardDiffExt.jl +++ b/ext/IntervalArithmeticForwardDiffExt.jl @@ -5,6 +5,7 @@ using ForwardDiff: Dual, ≺, value, partials # Needed to avoid method ambiguities: ForwardDiff.can_dual(::Type{ExactReal}) = true +Dual(x::ExactReal) = Dual{Nothing, typeof(x), 0}(x.value) Base.convert(::Type{Dual{T, V, N}}, x::ExactReal) where {T, V, N} = promote_rule(Dual{T, V, N}, typeof(x))(x.value) Base.promote_rule(::Type{Dual{T, V, N}}, ::Type{Interval{S}}) where {T, V, N, S<:Union{AbstractFloat, Rational}} =