JuliaMath / SpecialFunctions.jl

Special mathematical functions in Julia

Home Page:https://specialfunctions.juliamath.org/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use of `expint` with ForwardDiff

mancellin opened this issue · comments

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

scale = sqrt(floatmax(real(A)))

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.