SpecialFunctions.jl
SpecialFunctions.jl copied to clipboard
Use of `expint` with ForwardDiff
While trying to ForwardDiff expint, I got the following error:
MethodError: no method matching floatmax(::ForwardDiff.Dual{ForwardDiff.Tag{var"#135#136", Float64}, Float64, 3})
occurring at https://github.com/JuliaMath/SpecialFunctions.jl/blob/c400278f3b358aea817e03bfdf9e23c3c08557e5/src/expint.jl#L169
The issue is that ForwardDiff.jl only implements floatmax(T), while SpecialFunctions.jl uses floatmax(::T).
In Base, both are implemented, but only floatmax(T) is documented.
There are two possible straightforward solutions in this case (implementing floatmax(::T) in ForwardDiff, or adding a typeof in SpecialFunctions). Not sure if one of them should be preferred.