Skip to content

Commit

Permalink
fix xlogx, xlogy
Browse files Browse the repository at this point in the history
  • Loading branch information
cossio committed May 19, 2020
1 parent b7a603d commit 9ec064b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/basicfuns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ julia> StatsFuns.xlogx(0)
"""
function xlogx(x)
result = x * log(x)
ifelse(x > zero(x), result, zero(result))
ifelse(iszero(x), zero(result), result)
end

"""
Expand All @@ -23,7 +23,7 @@ Return `x * log(y)` for `y > 0` with correct limit at `x = 0`.
"""
function xlogy(x, y)
result = x * log(y)
ifelse(x > zero(x), result, zero(result))
ifelse(iszero(x) && y 0, zero(result), result)
end

# The following bounds are precomputed versions of the following abstract
Expand Down

0 comments on commit 9ec064b

Please sign in to comment.