Skip to content

Commit

Permalink
Avoid under/overflow with hypot
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaxen committed Dec 1, 2023
1 parent cb2941b commit a0667f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/integration/AdvancedHMC/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function compare_estimates(xs1, xs2, α=0.05)
p = α / 2
m1, s1 = mean_and_mcse(xs1)
m2, s2 = mean_and_mcse(xs2)
zs = @. (m1 - m2) / sqrt(s1^2 + s2^2)
zs = @. (m1 - m2) / hypot(s1, s2)
@test all(norminvcdf(p) .< zs .< norminvccdf(p))
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/DynamicHMC/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function compare_estimates(xs1, xs2, α=0.05)
p = α / 2
m1, s1 = mean_and_mcse(xs1)
m2, s2 = mean_and_mcse(xs2)
zs = @. (m1 - m2) / sqrt(s1^2 + s2^2)
zs = @. (m1 - m2) / hypot(s1, s2)
@test all(norminvcdf(p) .< zs .< norminvccdf(p))
end

Expand Down

0 comments on commit a0667f0

Please sign in to comment.