2
0
mirror of https://github.com/boostorg/math.git synced 2026-02-25 16:32:15 +00:00

Merge pull request #864 from mborland/warnings

Fix warnings in special functions
This commit is contained in:
Matt Borland
2022-11-29 08:42:26 -08:00
committed by GitHub
4 changed files with 7 additions and 5 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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{
@@ -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)
{

View File

@@ -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;