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

xexpx(z) #15

Closed
cossio opened this issue Oct 9, 2018 · 1 comment · Fixed by #35
Closed

xexpx(z) #15

cossio opened this issue Oct 9, 2018 · 1 comment · Fixed by #35

Comments

@cossio
Copy link
Contributor

cossio commented Oct 9, 2018

I frequently encounter the function xexpx(z) = z * exp(z), with the caveat that xexpx(-Inf) == 0. Thus xexpx(z) = xlogx(exp(z)), but computing it directly is faster because it avoids a superfluous log call and might prevent intermediate overflows..

Can we consider adding the definition:

xexpx(x::Real) = x == -Inf ? exp(x) : x * exp(x)
@devmotion devmotion transferred this issue from JuliaStats/StatsFuns.jl Apr 19, 2021
@tpapp
Copy link
Collaborator

tpapp commented Feb 18, 2022

JuliaStats/StatsFuns.jl#58 was just closed, but porting it here is welcome.

@cossio cossio mentioned this issue Mar 4, 2022
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

Successfully merging a pull request may close this issue.

2 participants