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

Base.Math.JuliaLibm.log1p infinite recursion #261

Closed
tpapp opened this issue Sep 18, 2017 · 2 comments
Closed

Base.Math.JuliaLibm.log1p infinite recursion #261

tpapp opened this issue Sep 18, 2017 · 2 comments

Comments

@tpapp
Copy link
Contributor

tpapp commented Sep 18, 2017

The function Base.Math.JuliaLibm.log1p (a more accurate, and usually faster version of Base.log1p) goes into infinite recursion when used with ForwardDiff.Duals. MWE:

julia> using ForwardDiff

julia> Base.Math.JuliaLibm.log1p(ForwardDiff.Dual(1.0,1.0))
VERSION
ERROR: StackOverflowError:
Stacktrace:
 [1] log1p(::ForwardDiff.Dual{Void,Float64,1}) at ./special/log.jl:395 (repeats 80000 times)

julia> VERSION
v"0.6.0"

julia> Pkg.status("ForwardDiff")
 - ForwardDiff                   0.5.0
@jrevels
Copy link
Member

jrevels commented Sep 18, 2017

Looks like Base.Math.JuliaLibm.log1p(x::Real) just calls Base.Math.JuliaLibm.log1p(float(x)), which basically guarantees infinite recursion in the general case (e.g. T = typeof(float(x)); T <: Real && !(T <: Float64) && !(T <: Float32)).

Easiest solution would be to add a rule for Base.Math.JuliaLibm.log1p to DiffRules.

tpapp added a commit to tpapp/ContinuousTransformations.jl that referenced this issue Sep 18, 2017
@tpapp
Copy link
Contributor Author

tpapp commented Dec 14, 2017

Closed by JuliaDiff/DiffRules.jl#8.

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