Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of expint with ForwardDiff #475

Open
mancellin opened this issue Jun 21, 2024 · 1 comment
Open

Use of expint with ForwardDiff #475

mancellin opened this issue Jun 21, 2024 · 1 comment

Comments

@mancellin
Copy link

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.

@ararslan
Copy link
Member

I was surprised at first that this didn't hit the Base method for values that just dispatches to calling floatmax on the type, but I realized that the fallback is only for AbstractFloat. SpecialFunctions is surely not the only user of the method for values so it seems like adding such a method to ForwardDiff would be a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants