ForwardDiff.jl icon indicating copy to clipboard operation
ForwardDiff.jl copied to clipboard

method ambiguity in `ForwardDiff.derivative(x -> ℯ^x, 1/2)`

Open jverzani opened this issue 5 years ago • 0 comments

It seems like a new method is needed to resolve this special case:

julia> ForwardDiff.derivative(x -> ℯ^x, 1/2)
ERROR: MethodError: ^(::Irrational{:ℯ}, ::ForwardDiff.Dual{ForwardDiff.Tag{var"#1#2",Float64},Float64,1}) is ambiguous. Candidates:
  ^(::Irrational{:ℯ}, x::Number) in Base.MathConstants at mathconstants.jl:91
  ^(x::Irrational, y::ForwardDiff.Dual{Ty,V,N} where N where V) where Ty in ForwardDiff at /Users/verzani/.julia/dev/ForwardDiff/src/dual.jl:140
Possible fix, define
  ^(::Irrational{:ℯ}, ::ForwardDiff.Dual{Ty,V,N} where N where V) where Ty

This is due to euler being special cased among the irrational values in mathconstants.jl

jverzani avatar Nov 05 '20 19:11 jverzani