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

logaddexp introduces NaNs for non-finite values #61

Open
tpapp opened this issue Nov 23, 2022 · 1 comment
Open

logaddexp introduces NaNs for non-finite values #61

tpapp opened this issue Nov 23, 2022 · 1 comment

Comments

@tpapp
Copy link
Collaborator

tpapp commented Nov 23, 2022

julia> using ForwardDiff, LogExpFunctions

julia> x = ForwardDiff.Dual(-Inf, 0.0)
Dual{Nothing}(-Inf,0.0)

julia> logaddexp(x, x)
Dual{Nothing}(-Inf,NaN)

I think this is related to JuliaDiff/ForwardDiff.jl#481.

It is the a == b in logaddexp, but I am not yet sure how to elegantly special-case this.

@tpapp
Copy link
Collaborator Author

tpapp commented Nov 23, 2022

Conceptually, I would be OK with logaddexp(a, b) === b whenever a <= -Inf, after suitable promotion, and similarly of course for the arguments exchanged. This is the only one I would care to special-case, the rest can (and should) just propagate Inf and NaN.

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

1 participant