From 2d9d202ff13c49b3202e5c24d0d19e84e62d4b09 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 1 Sep 2023 17:21:25 +0100 Subject: [PATCH] Fix conceptual failures. --- include/boost/math/special_functions/beta.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/math/special_functions/beta.hpp b/include/boost/math/special_functions/beta.hpp index a11c8a8048..207cf185cc 100644 --- a/include/boost/math/special_functions/beta.hpp +++ b/include/boost/math/special_functions/beta.hpp @@ -393,14 +393,14 @@ T ibeta_power_terms(T a, else { // This protects against spurious overflow in a/b: - T p1 = (b1 < 1) && (b < 1) && (tools::max_value() * b < a) ? 0 : pow(b1, a / b); + T p1 = (b1 < 1) && (b < 1) && (tools::max_value() * b < a) ? static_cast(0) : static_cast(pow(b1, a / b)); T l3 = (p1 != 0) && (b2 != 0) ? (log(p1) + log(b2)) * b : tools::max_value(); // arbitrary large value if the logs would fail! if((l3 < tools::log_max_value()) && (l3 > tools::log_min_value())) { result *= pow(p1 * b2, b); } - else if(result) // we can elude the calculation below if we're already going to be zero + else if(result != 0) // we can elude the calculation below if we're already going to be zero { l2 += l1 + log(result); if(l2 >= tools::log_max_value()) @@ -696,7 +696,7 @@ T ibeta_series(T a, T b, T x, T s0, const Lanczos&, bool normalised, T* p_deriva // // Oh dear, we need logs, and this *will* cancel: // - if (result) // elude calculation when result will be zero. + if (result != 0) // elude calculation when result will be zero. { result = log(result) + l1 + l2 + (log(agh) - 1) / 2; if (p_derivative)