JuliaDiff / JuliaDiff/ForwardDiff.jl
method ambiguity in `ForwardDiff.derivative(x -> ℯ^x, 1/2)`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 1k
- Forks
- 160
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the ambiguity with the ForwardDiff.derivative example, then inspect ForwardDiff/src/dual.jl around line 140 and Julia's mathconstants.jl around line 91. Compare the overlapping exponentiation methods and add focused coverage for the Irrational{:ℯ} and Dual combination; done means the example dispatches without MethodError and the relevant tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100