Skip to content

Commit 2d9d202

Browse files
committed
Fix conceptual failures.
1 parent 8ff6bc1 commit 2d9d202

File tree

1 file changed

+3
-3
lines changed
  • include/boost/math/special_functions

1 file changed

+3
-3
lines changed

include/boost/math/special_functions/beta.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,14 @@ T ibeta_power_terms(T a,
393393
else
394394
{
395395
// This protects against spurious overflow in a/b:
396-
T p1 = (b1 < 1) && (b < 1) && (tools::max_value<T>() * b < a) ? 0 : pow(b1, a / b);
396+
T p1 = (b1 < 1) && (b < 1) && (tools::max_value<T>() * b < a) ? static_cast<T>(0) : static_cast<T>(pow(b1, a / b));
397397
T l3 = (p1 != 0) && (b2 != 0) ? (log(p1) + log(b2)) * b : tools::max_value<T>(); // arbitrary large value if the logs would fail!
398398
if((l3 < tools::log_max_value<T>())
399399
&& (l3 > tools::log_min_value<T>()))
400400
{
401401
result *= pow(p1 * b2, b);
402402
}
403-
else if(result) // we can elude the calculation below if we're already going to be zero
403+
else if(result != 0) // we can elude the calculation below if we're already going to be zero
404404
{
405405
l2 += l1 + log(result);
406406
if(l2 >= tools::log_max_value<T>())
@@ -696,7 +696,7 @@ T ibeta_series(T a, T b, T x, T s0, const Lanczos&, bool normalised, T* p_deriva
696696
//
697697
// Oh dear, we need logs, and this *will* cancel:
698698
//
699-
if (result) // elude calculation when result will be zero.
699+
if (result != 0) // elude calculation when result will be zero.
700700
{
701701
result = log(result) + l1 + l2 + (log(agh) - 1) / 2;
702702
if (p_derivative)

0 commit comments

Comments
 (0)