-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
mathsMathematical functionsMathematical functions
Description
On 0.6.2:
julia> using ForwardDiff
julia> ForwardDiff.derivative(sinpi, 1.)
0.0on b571283:
julia> using ForwardDiff
julia> ForwardDiff.derivative(sinpi, 1.)
ERROR: StackOverflowError:
Stacktrace:
[1] sinpi(::ForwardDiff.Dual{ForwardDiff.Tag{typeof(sinpi),Float64},Float64,1}) at ./special/trig.jl:865 (repeats 80000 times)This is because of
Line 865 in 7674aca
| sinpi(x::Real) = sinpi(float(x)) |
which seems unfortunate. Similarly, log1p required a workaround in DiffRules. I wholeheartedly agree with JuliaDiff/ForwardDiff.jl#261 (comment):
Looks like
Base.Math.JuliaLibm.log1p(x::Real)just callsBase.Math.JuliaLibm.log1p(float(x)), which basically guarantees infinite recursion in the general case
log and cospi also have this issue. Maybe others as well?
baggepinnen, chriscoey, dpsanders and schneiderfelipe
Metadata
Metadata
Assignees
Labels
mathsMathematical functionsMathematical functions