@@ -56,20 +56,20 @@ inline auto wiener_prob_derivative_term(const T_a& a, const T_v& v,
5656 const T_w& w) noexcept {
5757 using ret_t = return_type_t <T_a, T_w, T_v>;
5858 const auto exponent_m1 = log1m (1.1 * 1.0e-8 );
59- ret_t ans;
6059 const auto neg_v = -v;
6160 const auto one_m_w = 1 - w;
6261 int sign_v = neg_v < 0 ? 1 : -1 ;
6362 const auto two_a_neg_v = 2.0 * a * neg_v;
6463 const auto exponent_with_1mw = sign_v * two_a_neg_v * w;
65- const auto exponent = ( sign_v * two_a_neg_v) ;
64+ const auto exponent = sign_v * two_a_neg_v;
6665 const auto exponent_with_w = two_a_neg_v * one_m_w;
6766 // truncating longer calculations, for numerical stability
6867 if (unlikely ((exponent_with_1mw >= exponent_m1)
6968 || ((exponent_with_w >= exponent_m1) && (sign_v == 1 ))
7069 || (exponent >= exponent_m1) || neg_v == 0 )) {
7170 return ret_t (-one_m_w);
7271 }
72+ ret_t ans;
7373 ret_t diff_term;
7474 const auto log_w = log (one_m_w);
7575 if (neg_v < 0 ) {
@@ -133,7 +133,7 @@ inline auto wiener4_ccdf_grad_a(const T_y& y, const T_a& a, const T_v& v,
133133 // derivative of the wiener probability w.r.t. 'a' (on log-scale)
134134 auto prob_grad_a = -wiener_prob_derivative_term (a, v, w) * v;
135135 if (!is_scal_finite (prob_grad_a)) {
136- prob_grad_a = ret_t (NEGATIVE_INFTY);
136+ return ret_t (NEGATIVE_INFTY);
137137 }
138138 const auto log_prob_hit_upper = log_wiener_prob_hit_upper (a, v, w);
139139 const auto cdf_grad_a = wiener4_cdf_grad_a (y, a, v, w, cdf, log_err);
0 commit comments