-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fallback math methods for ::Real are likely to call themselves #26552
Comments
Do you have a different way to express this in mind that wouldn't have this issue? |
How about turning sinpi(x::T) where T<:AbstractFloat into _sinpi(x::T) where T<:AbstractFloat and have sinpi(x::Real) = _sinpi(float(x)) |
This is similarly handled in other places with a generic |
That assumes that |
We could make that assumption more explicit by using |
That would certainly be an improvement, |
any path forward on this? I am struggling with this issue: JuliaDiff/ForwardDiff.jl#324 |
I think that the original intention for my_calculation(x::Real) = my_calculation(float(x)) is that With the combination of user-defined types and functions, this is very difficult to enforce or even explicitly specify. Eg one could require that In retrospect, I think
(1) and (3) are breaking suggestions, but (2) can be addressed in the docstring of Packages should not define a method for |
Yeah. At this point, I think we've fixed this for basically everything: Line 1174 in 3635f04
|
On 0.6.2:
on b571283:
This is because of
julia/base/special/trig.jl
Line 865 in 7674aca
which seems unfortunate. Similarly,
log1p
required a workaround in DiffRules. I wholeheartedly agree with JuliaDiff/ForwardDiff.jl#261 (comment):log
andcospi
also have this issue. Maybe others as well?The text was updated successfully, but these errors were encountered: