Skip to content

Commit

Permalink
log of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
konkam committed Nov 8, 2018
1 parent 7950c8b commit 3b54741
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/helper_functions.jl
Expand Up @@ -41,7 +41,7 @@ function signed_log_sum_exp(lx, signs)
m = maximum(lx)
scaled_sum = sum(signs .* exp.(lx .- m))
if scaled_sum == 0
return [1., 0.]
return [1., -Inf]
elseif scaled_sum < 0
sgn = -1
scaled_sum = -1*scaled_sum
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper_functions.jl
Expand Up @@ -10,5 +10,5 @@ using StatsFuns
@test res[1] == -1.0
res = ExactWrightFisher.signed_log_sum_exp([2, 2, 4, 4], [1, -1, 1, -1])
@test res[1] == 1.0
@test res[2] == 0
@test res[2] == -Inf
end

0 comments on commit 3b54741

Please sign in to comment.