From 192954be68f5fb0a7c3b20644972d215e95eb112 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Sun, 30 Oct 2022 17:37:15 -0700 Subject: [PATCH 1/4] Fix warning C4244: 'initializing': conversion from 'double' to 'T' --- .../math/special_functions/detail/hypergeometric_series.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/math/special_functions/detail/hypergeometric_series.hpp b/include/boost/math/special_functions/detail/hypergeometric_series.hpp index c4915bdcf..2a2a54af9 100644 --- a/include/boost/math/special_functions/detail/hypergeometric_series.hpp +++ b/include/boost/math/special_functions/detail/hypergeometric_series.hpp @@ -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(boost::math::lgamma(T(z + n), &s1, pol) - boost::math::lgamma(z, &s2, pol)); if(s) *s = s1 * s2; return r; From 5f15252ea0559ae4c8813d51f2a3f1cb621fa8ed Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Sun, 30 Oct 2022 17:42:54 -0700 Subject: [PATCH 2/4] Fix warning C4244: conversion from 'double' to 'T' --- include/boost/math/special_functions/beta.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/math/special_functions/beta.hpp b/include/boost/math/special_functions/beta.hpp index f74937c1a..2bc42b7af 100644 --- a/include/boost/math/special_functions/beta.hpp +++ b/include/boost/math/special_functions/beta.hpp @@ -960,14 +960,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(itrunc(n), itrunc(start), pol); + result = static_cast(pow(x, start) * pow(y, n - start) * boost::math::binomial_coefficient(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(itrunc(n), itrunc(i), pol); + result += static_cast(pow(x, static_cast(i)) * pow(y, n - i) * boost::math::binomial_coefficient(itrunc(n), itrunc(i), pol)); } } else From 00bb718a9cb688b1b26ede9613b4412f93265479 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Sun, 30 Oct 2022 17:47:41 -0700 Subject: [PATCH 3/4] Fix warning C4244: 'initializing': conversion from 'double' to 'T' --- .../boost/math/special_functions/detail/bessel_jy_series.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/math/special_functions/detail/bessel_jy_series.hpp b/include/boost/math/special_functions/detail/bessel_jy_series.hpp index 35d3ae103..6d9ff15fa 100644 --- a/include/boost/math/special_functions/detail/bessel_jy_series.hpp +++ b/include/boost/math/special_functions/detail/bessel_jy_series.hpp @@ -12,6 +12,8 @@ #include #include +#include +#include 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(pow(z / 2, n)); T result = -((boost::math::factorial(n - 1, pol) / constants::pi())); if(p * tools::max_value() < result) { From 9d15701d1190153c9d108b7b80485857f2dd4af6 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Sun, 30 Oct 2022 17:56:46 -0700 Subject: [PATCH 4/4] Fix warning C4305: 'initializing': truncation from 'double' to 'Real' --- include/boost/math/special_functions/chebyshev.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/math/special_functions/chebyshev.hpp b/include/boost/math/special_functions/chebyshev.hpp index 8d64febc6..d69fd9c50 100644 --- a/include/boost/math/special_functions/chebyshev.hpp +++ b/include/boost/math/special_functions/chebyshev.hpp @@ -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(0.6L); if (x - a < b - x) { u = 2*(x-a)/(b-a);