Skip to content

Commit

Permalink
fixes #3035 by using log_modified_bessel to improve stability
Browse files Browse the repository at this point in the history
  • Loading branch information
venpopov committed Mar 23, 2024
1 parent e8ab249 commit 787256c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stan/math/prim/prob/von_mises_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ return_type_t<T_y, T_loc, T_scale> von_mises_lpdf(T_y const& y, T_loc const& mu,
if (!is_constant_all<T_scale>::value) {
edge<2>(ops_partials).partials_
= cos_mu_minus_y
- modified_bessel_first_kind(1, kappa_val)
/ modified_bessel_first_kind(0, kappa_val);
- exp(log_modified_bessel_first_kind(1, kappa_val)
- log_modified_bessel_first_kind(0, kappa_val));
}

return ops_partials.build(logp);
Expand Down

0 comments on commit 787256c

Please sign in to comment.