Skip to content

Commit

Permalink
Merge pull request #864 from mborland/warnings
Browse files Browse the repository at this point in the history
Fix warnings in special functions
  • Loading branch information
mborland authored Nov 29, 2022
2 parents ea8d3bf + 9d15701 commit 4e77917
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/boost/math/special_functions/beta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -963,14 +963,14 @@ T binomial_ccdf(T n, T k, T x, T y, const Policy& pol)
int start = itrunc(n * x);
if(start <= k + 1)
start = itrunc(k + 2);
result = pow(x, start) * pow(y, n - start) * boost::math::binomial_coefficient<T>(itrunc(n), itrunc(start), pol);
result = static_cast<T>(pow(x, start) * pow(y, n - start) * boost::math::binomial_coefficient<T>(itrunc(n), itrunc(start), pol));
if(result == 0)
{
// OK, starting slightly above the mode didn't work,
// we'll have to sum the terms the old fashioned way:
for(unsigned i = start - 1; i > k; --i)
{
result += pow(x, (int)i) * pow(y, n - i) * boost::math::binomial_coefficient<T>(itrunc(n), itrunc(i), pol);
result += static_cast<T>(pow(x, static_cast<int>(i)) * pow(y, n - i) * boost::math::binomial_coefficient<T>(itrunc(n), itrunc(i), pol));
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion include/boost/math/special_functions/chebyshev.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ inline Real unchecked_chebyshev_clenshaw_recurrence(const Real* const c, size_t
// See "An Error Analysis of the Modified Clenshaw Method for Evaluating Chebyshev and Fourier Series"
// J. OLIVER, IMA Journal of Applied Mathematics, Volume 20, Issue 3, November 1977, Pages 379-391
// https://doi.org/10.1093/imamat/20.3.379
const Real cutoff = 0.6;
const auto cutoff = static_cast<Real>(0.6L);
if (x - a < b - x)
{
u = 2*(x-a)/(b-a);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <cmath>
#include <cstdint>
#include <boost/math/tools/config.hpp>
#include <boost/math/tools/assert.hpp>

namespace boost { namespace math { namespace detail{

Expand Down Expand Up @@ -234,7 +236,7 @@ T bessel_yn_small_z(int n, T z, T* scale, const Policy& pol)
}
else
{
T p = pow(z / 2, n);
auto p = static_cast<T>(pow(z / 2, n));
T result = -((boost::math::factorial<T>(n - 1, pol) / constants::pi<T>()));
if(p * tools::max_value<T>() < result)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
return r;
}
int s1, s2;
T r = boost::math::lgamma(T(z + n), &s1, pol) - boost::math::lgamma(z, &s2, pol);
auto r = static_cast<T>(boost::math::lgamma(T(z + n), &s1, pol) - boost::math::lgamma(z, &s2, pol));
if(s)
*s = s1 * s2;
return r;
Expand Down

0 comments on commit 4e77917

Please sign in to comment.