From c5b4d28e05bd8eecda3ef19cb4ec428042644776 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 15 May 2023 17:08:41 +0100 Subject: [PATCH] Suppress lots of warnings for std::float32_t. Better configure promote_args test case. --- .../math/distributions/inverse_gaussian.hpp | 4 +- .../boost/math/distributions/skew_normal.hpp | 4 +- .../special_functions/detail/polygamma.hpp | 6 +- .../boost/math/special_functions/digamma.hpp | 2 +- .../boost/math/special_functions/ellint_1.hpp | 328 +++++++++--------- .../boost/math/special_functions/ellint_2.hpp | 288 +++++++-------- .../special_functions/hypergeometric_2F0.hpp | 2 +- .../boost/math/special_functions/legendre.hpp | 2 +- .../boost/math/special_functions/owens_t.hpp | 2 +- include/boost/math/special_functions/zeta.hpp | 4 +- test/compile_test/test_promote_args.cpp | 6 +- 11 files changed, 326 insertions(+), 322 deletions(-) diff --git a/include/boost/math/distributions/inverse_gaussian.hpp b/include/boost/math/distributions/inverse_gaussian.hpp index b057b4469..c8e46913a 100644 --- a/include/boost/math/distributions/inverse_gaussian.hpp +++ b/include/boost/math/distributions/inverse_gaussian.hpp @@ -382,7 +382,7 @@ inline RealType quantile(const inverse_gaussian_distribution& RealType guess = detail::guess_ig(p, dist.mean(), dist.scale()); using boost::math::tools::max_value; - RealType min = 0.; // Minimum possible value is bottom of range of distribution. + RealType min = static_cast(0); // Minimum possible value is bottom of range of distribution. RealType max = max_value();// Maximum possible value is top of range. // int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. // digits used to control how accurate to try to make the result. @@ -454,7 +454,7 @@ inline RealType quantile(const complemented2_type(0); // Minimum possible value is bottom of range of distribution. RealType max = max_value();// Maximum possible value is top of range. // int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. // digits used to control how accurate to try to make the result. diff --git a/include/boost/math/distributions/skew_normal.hpp b/include/boost/math/distributions/skew_normal.hpp index 646965995..c2843fea1 100644 --- a/include/boost/math/distributions/skew_normal.hpp +++ b/include/boost/math/distributions/skew_normal.hpp @@ -486,7 +486,7 @@ namespace boost{ namespace math{ // 21 elements static const RealType shapes[] = { - 0.0, + static_cast(0.0), static_cast(1.000000000000000e-004), static_cast(2.069138081114790e-004), static_cast(4.281332398719396e-004), @@ -511,7 +511,7 @@ namespace boost{ namespace math{ // 21 elements static const RealType guess[] = { - 0.0, + static_cast(0.0), static_cast(5.000050000525391e-005), static_cast(1.500015000148736e-004), static_cast(3.500035000350010e-004), diff --git a/include/boost/math/special_functions/detail/polygamma.hpp b/include/boost/math/special_functions/detail/polygamma.hpp index 3a7c984ed..00b0b1ec3 100644 --- a/include/boost/math/special_functions/detail/polygamma.hpp +++ b/include/boost/math/special_functions/detail/polygamma.hpp @@ -53,7 +53,7 @@ namespace boost { namespace math { namespace detail{ if(n == 1) return 1 / x; T nlx = n * log(x); if((nlx < tools::log_max_value()) && (n < (int)max_factorial::value)) - return ((n & 1) ? 1 : -1) * boost::math::factorial(n - 1, pol) * pow(x, -n); + return ((n & 1) ? 1 : -1) * boost::math::factorial(n - 1, pol) * static_cast(pow(x, -n)); else return ((n & 1) ? 1 : -1) * exp(boost::math::lgamma(T(n), pol) - n * log(x)); } @@ -159,7 +159,7 @@ namespace boost { namespace math { namespace detail{ { for(int k = 1; k <= iter; ++k) { - z_plus_k_pow_minus_m_minus_one = pow(z, minus_m_minus_one); + z_plus_k_pow_minus_m_minus_one = static_cast(pow(z, minus_m_minus_one)); sum0 += z_plus_k_pow_minus_m_minus_one; z += 1; } @@ -203,7 +203,7 @@ namespace boost { namespace math { namespace detail{ // be n! / z^(n+1), but since we're scaling by n! it's just // 1 / z^(n+1) for now: // - T prefix = pow(x, n + 1); + T prefix = static_cast(pow(x, n + 1)); // Warning supression: Integer power returns at least a double if(prefix == 0) return boost::math::policies::raise_overflow_error(function, nullptr, pol); prefix = 1 / prefix; diff --git a/include/boost/math/special_functions/digamma.hpp b/include/boost/math/special_functions/digamma.hpp index 92f916e11..363e4cd5f 100644 --- a/include/boost/math/special_functions/digamma.hpp +++ b/include/boost/math/special_functions/digamma.hpp @@ -379,7 +379,7 @@ inline T digamma_imp_1_2(T x, const std::integral_constant*) -0.61041765350579073e-1f }; static const T Q[] = { - 0.1e1, + 0.1e1f, 0.15890202430554952e1f, 0.65341249856146947e0f, 0.63851690523355715e-1f diff --git a/include/boost/math/special_functions/ellint_1.hpp b/include/boost/math/special_functions/ellint_1.hpp index a47ad7676..d3243c3fa 100644 --- a/include/boost/math/special_functions/ellint_1.hpp +++ b/include/boost/math/special_functions/ellint_1.hpp @@ -202,20 +202,20 @@ BOOST_FORCEINLINE T ellint_k_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.591003453790792180, - 0.416000743991786912, - 0.245791514264103415, - 0.179481482914906162, - 0.144556057087555150, - 0.123200993312427711, - 0.108938811574293531, - 0.098853409871592910, - 0.091439629201749751, - 0.085842591595413900, - 0.081541118718303215, - 0.078199656811256481910 + static_cast(1.591003453790792180), + static_cast(0.416000743991786912), + static_cast(0.245791514264103415), + static_cast(0.179481482914906162), + static_cast(0.144556057087555150), + static_cast(0.123200993312427711), + static_cast(0.108938811574293531), + static_cast(0.098853409871592910), + static_cast(0.091439629201749751), + static_cast(0.085842591595413900), + static_cast(0.081541118718303215), + static_cast(0.078199656811256481910) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.05); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.05)); } case 2: case 3: @@ -223,20 +223,20 @@ BOOST_FORCEINLINE T ellint_k_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.635256732264579992, - 0.471190626148732291, - 0.309728410831499587, - 0.252208311773135699, - 0.226725623219684650, - 0.215774446729585976, - 0.213108771877348910, - 0.216029124605188282, - 0.223255831633057896, - 0.234180501294209925, - 0.248557682972264071, - 0.266363809892617521 + static_cast(1.635256732264579992), + static_cast(0.471190626148732291), + static_cast(0.309728410831499587), + static_cast(0.252208311773135699), + static_cast(0.226725623219684650), + static_cast(0.215774446729585976), + static_cast(0.213108771877348910), + static_cast(0.216029124605188282), + static_cast(0.223255831633057896), + static_cast(0.234180501294209925), + static_cast(0.248557682972264071), + static_cast(0.266363809892617521) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.15); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.15)); } case 4: case 5: @@ -244,20 +244,20 @@ BOOST_FORCEINLINE T ellint_k_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.685750354812596043, - 0.541731848613280329, - 0.401524438390690257, - 0.369642473420889090, - 0.376060715354583645, - 0.405235887085125919, - 0.453294381753999079, - 0.520518947651184205, - 0.609426039204995055, - 0.724263522282908870, - 0.871013847709812357, - 1.057652872753547036 + static_cast(1.685750354812596043), + static_cast(0.541731848613280329), + static_cast(0.401524438390690257), + static_cast(0.369642473420889090), + static_cast(0.376060715354583645), + static_cast(0.405235887085125919), + static_cast(0.453294381753999079), + static_cast(0.520518947651184205), + static_cast(0.609426039204995055), + static_cast(0.724263522282908870), + static_cast(0.871013847709812357), + static_cast(1.057652872753547036) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.25); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.25)); } case 6: case 7: @@ -265,21 +265,21 @@ BOOST_FORCEINLINE T ellint_k_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.744350597225613243, - 0.634864275371935304, - 0.539842564164445538, - 0.571892705193787391, - 0.670295136265406100, - 0.832586590010977199, - 1.073857448247933265, - 1.422091460675497751, - 1.920387183402304829, - 2.632552548331654201, - 3.652109747319039160, - 5.115867135558865806, - 7.224080007363877411 + static_cast(1.744350597225613243), + static_cast(0.634864275371935304), + static_cast(0.539842564164445538), + static_cast(0.571892705193787391), + static_cast(0.670295136265406100), + static_cast(0.832586590010977199), + static_cast(1.073857448247933265), + static_cast(1.422091460675497751), + static_cast(1.920387183402304829), + static_cast(2.632552548331654201), + static_cast(3.652109747319039160), + static_cast(5.115867135558865806), + static_cast(7.224080007363877411) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.35); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.35)); } case 8: case 9: @@ -287,22 +287,22 @@ BOOST_FORCEINLINE T ellint_k_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.813883936816982644, - 0.763163245700557246, - 0.761928605321595831, - 0.951074653668427927, - 1.315180671703161215, - 1.928560693477410941, - 2.937509342531378755, - 4.594894405442878062, - 7.330071221881720772, - 11.87151259742530180, - 19.45851374822937738, - 32.20638657246426863, - 53.73749198700554656, - 90.27388602940998849 + static_cast(1.813883936816982644), + static_cast(0.763163245700557246), + static_cast(0.761928605321595831), + static_cast(0.951074653668427927), + static_cast(1.315180671703161215), + static_cast(1.928560693477410941), + static_cast(2.937509342531378755), + static_cast(4.594894405442878062), + static_cast(7.330071221881720772), + static_cast(11.87151259742530180), + static_cast(19.45851374822937738), + static_cast(32.20638657246426863), + static_cast(53.73749198700554656), + static_cast(90.27388602940998849) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.45); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.45)); } case 10: case 11: @@ -310,23 +310,23 @@ BOOST_FORCEINLINE T ellint_k_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.898924910271553526, - 0.950521794618244435, - 1.151077589959015808, - 1.750239106986300540, - 2.952676812636875180, - 5.285800396121450889, - 9.832485716659979747, - 18.78714868327559562, - 36.61468615273698145, - 72.45292395127771801, - 145.1079577347069102, - 293.4786396308497026, - 598.3851815055010179, - 1228.420013075863451, - 2536.529755382764488 + static_cast(1.898924910271553526), + static_cast(0.950521794618244435), + static_cast(1.151077589959015808), + static_cast(1.750239106986300540), + static_cast(2.952676812636875180), + static_cast(5.285800396121450889), + static_cast(9.832485716659979747), + static_cast(18.78714868327559562), + static_cast(36.61468615273698145), + static_cast(72.45292395127771801), + static_cast(145.1079577347069102), + static_cast(293.4786396308497026), + static_cast(598.3851815055010179), + static_cast(1228.420013075863451), + static_cast(2536.529755382764488) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.55); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.55)); } case 12: case 13: @@ -334,106 +334,106 @@ BOOST_FORCEINLINE T ellint_k_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 2.007598398424376302, - 1.248457231212347337, - 1.926234657076479729, - 3.751289640087587680, - 8.119944554932045802, - 18.66572130873555361, - 44.60392484291437063, - 109.5092054309498377, - 274.2779548232413480, - 697.5598008606326163, - 1795.716014500247129, - 4668.381716790389910, - 12235.76246813664335, - 32290.17809718320818, - 85713.07608195964685, - 228672.1890493117096, - 612757.2711915852774 + static_cast(2.007598398424376302), + static_cast(1.248457231212347337), + static_cast(1.926234657076479729), + static_cast(3.751289640087587680), + static_cast(8.119944554932045802), + static_cast(18.66572130873555361), + static_cast(44.60392484291437063), + static_cast(109.5092054309498377), + static_cast(274.2779548232413480), + static_cast(697.5598008606326163), + static_cast(1795.716014500247129), + static_cast(4668.381716790389910), + static_cast(12235.76246813664335), + static_cast(32290.17809718320818), + static_cast(85713.07608195964685), + static_cast(228672.1890493117096), + static_cast(612757.2711915852774) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.65); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.65)); } case 14: case 15: - //else if (m < 0.8) + //else if (m < static_cast(0.8)) { constexpr T coef[] = { - 2.156515647499643235, - 1.791805641849463243, - 3.826751287465713147, - 10.38672468363797208, - 31.40331405468070290, - 100.9237039498695416, - 337.3268282632272897, - 1158.707930567827917, - 4060.990742193632092, - 14454.00184034344795, - 52076.66107599404803, - 189493.6591462156887, - 695184.5762413896145, - 2567994.048255284686, - 9541921.966748386322, - 35634927.44218076174, - 133669298.4612040871, - 503352186.6866284541, - 1901975729.538660119, - 7208915015.330103756 + static_cast(2.156515647499643235), + static_cast(1.791805641849463243), + static_cast(3.826751287465713147), + static_cast(10.38672468363797208), + static_cast(31.40331405468070290), + static_cast(100.9237039498695416), + static_cast(337.3268282632272897), + static_cast(1158.707930567827917), + static_cast(4060.990742193632092), + static_cast(14454.00184034344795), + static_cast(52076.66107599404803), + static_cast(189493.6591462156887), + static_cast(695184.5762413896145), + static_cast(2567994.048255284686), + static_cast(9541921.966748386322), + static_cast(35634927.44218076174), + static_cast(133669298.4612040871), + static_cast(503352186.6866284541), + static_cast(1901975729.538660119), + static_cast(7208915015.330103756) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.75); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.75)); } case 16: - //else if (m < 0.85) + //else if (m < static_cast(0.85)) { constexpr T coef[] = { - 2.318122621712510589, - 2.616920150291232841, - 7.897935075731355823, - 30.50239715446672327, - 131.4869365523528456, - 602.9847637356491617, - 2877.024617809972641, - 14110.51991915180325, - 70621.44088156540229, - 358977.2665825309926, - 1847238.263723971684, - 9600515.416049214109, - 50307677.08502366879, - 265444188.6527127967, - 1408862325.028702687, - 7515687935.373774627 + static_cast(2.318122621712510589), + static_cast(2.616920150291232841), + static_cast(7.897935075731355823), + static_cast(30.50239715446672327), + static_cast(131.4869365523528456), + static_cast(602.9847637356491617), + static_cast(2877.024617809972641), + static_cast(14110.51991915180325), + static_cast(70621.44088156540229), + static_cast(358977.2665825309926), + static_cast(1847238.263723971684), + static_cast(9600515.416049214109), + static_cast(50307677.08502366879), + static_cast(265444188.6527127967), + static_cast(1408862325.028702687), + static_cast(7515687935.373774627) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.825); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.825)); } case 17: - //else if (m < 0.90) + //else if (m < static_cast(0.90)) { constexpr T coef[] = { - 2.473596173751343912, - 3.727624244118099310, - 15.60739303554930496, - 84.12850842805887747, - 506.9818197040613935, - 3252.277058145123644, - 21713.24241957434256, - 149037.0451890932766, - 1043999.331089990839, - 7427974.817042038995, - 53503839.67558661151, - 389249886.9948708474, - 2855288351.100810619, - 21090077038.76684053, - 156699833947.7902014, - 1170222242422.439893, - 8777948323668.937971, - 66101242752484.95041, - 499488053713388.7989, - 37859743397240299.20 + static_cast(2.473596173751343912), + static_cast(3.727624244118099310), + static_cast(15.60739303554930496), + static_cast(84.12850842805887747), + static_cast(506.9818197040613935), + static_cast(3252.277058145123644), + static_cast(21713.24241957434256), + static_cast(149037.0451890932766), + static_cast(1043999.331089990839), + static_cast(7427974.817042038995), + static_cast(53503839.67558661151), + static_cast(389249886.9948708474), + static_cast(2855288351.100810619), + static_cast(21090077038.76684053), + static_cast(156699833947.7902014), + static_cast(1170222242422.439893), + static_cast(8777948323668.937971), + static_cast(66101242752484.95041), + static_cast(499488053713388.7989), + static_cast(37859743397240299.20) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.875); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.875)); } default: // diff --git a/include/boost/math/special_functions/ellint_2.hpp b/include/boost/math/special_functions/ellint_2.hpp index e135264cc..023c5cbe4 100644 --- a/include/boost/math/special_functions/ellint_2.hpp +++ b/include/boost/math/special_functions/ellint_2.hpp @@ -203,19 +203,19 @@ BOOST_FORCEINLINE T ellint_e_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.550973351780472328, - -0.400301020103198524, - -0.078498619442941939, - -0.034318853117591992, - -0.019718043317365499, - -0.013059507731993309, - -0.009442372874146547, - -0.007246728512402157, - -0.005807424012956090, - -0.004809187786009338, - -0.004086399233255150 + static_cast(1.550973351780472328), + -static_cast(0.400301020103198524), + -static_cast(0.078498619442941939), + -static_cast(0.034318853117591992), + -static_cast(0.019718043317365499), + -static_cast(0.013059507731993309), + -static_cast(0.009442372874146547), + -static_cast(0.007246728512402157), + -static_cast(0.005807424012956090), + -static_cast(0.004809187786009338), + -static_cast(0.004086399233255150) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.05); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.05)); } case 2: case 3: @@ -223,19 +223,19 @@ BOOST_FORCEINLINE T ellint_e_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.510121832092819728, - -0.417116333905867549, - -0.090123820404774569, - -0.043729944019084312, - -0.027965493064761785, - -0.020644781177568105, - -0.016650786739707238, - -0.014261960828842520, - -0.012759847429264803, - -0.011799303775587354, - -0.011197445703074968 + static_cast(1.510121832092819728), + -static_cast(0.417116333905867549), + -static_cast(0.090123820404774569), + -static_cast(0.043729944019084312), + -static_cast(0.027965493064761785), + -static_cast(0.020644781177568105), + -static_cast(0.016650786739707238), + -static_cast(0.014261960828842520), + -static_cast(0.012759847429264803), + -static_cast(0.011799303775587354), + -static_cast(0.011197445703074968) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.15); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.15)); } case 4: case 5: @@ -243,19 +243,19 @@ BOOST_FORCEINLINE T ellint_e_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.467462209339427155, - -0.436576290946337775, - -0.105155557666942554, - -0.057371843593241730, - -0.041391627727340220, - -0.034527728505280841, - -0.031495443512532783, - -0.030527000890325277, - -0.030916984019238900, - -0.032371395314758122, - -0.034789960386404158 + static_cast(1.467462209339427155), + -static_cast(0.436576290946337775), + -static_cast(0.105155557666942554), + -static_cast(0.057371843593241730), + -static_cast(0.041391627727340220), + -static_cast(0.034527728505280841), + -static_cast(0.031495443512532783), + -static_cast(0.030527000890325277), + -static_cast(0.030916984019238900), + -static_cast(0.032371395314758122), + -static_cast(0.034789960386404158) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.25); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.25)); } case 6: case 7: @@ -263,20 +263,20 @@ BOOST_FORCEINLINE T ellint_e_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.422691133490879171, - -0.459513519621048674, - -0.125250539822061878, - -0.078138545094409477, - -0.064714278472050002, - -0.062084339131730311, - -0.065197032815572477, - -0.072793895362578779, - -0.084959075171781003, - -0.102539850131045997, - -0.127053585157696036, - -0.160791120691274606 + static_cast(1.422691133490879171), + -static_cast(0.459513519621048674), + -static_cast(0.125250539822061878), + -static_cast(0.078138545094409477), + -static_cast(0.064714278472050002), + -static_cast(0.062084339131730311), + -static_cast(0.065197032815572477), + -static_cast(0.072793895362578779), + -static_cast(0.084959075171781003), + -static_cast(0.102539850131045997), + -static_cast(0.127053585157696036), + -static_cast(0.160791120691274606) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.35); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.35)); } case 8: case 9: @@ -284,21 +284,21 @@ BOOST_FORCEINLINE T ellint_e_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.375401971871116291, - -0.487202183273184837, - -0.153311701348540228, - -0.111849444917027833, - -0.108840952523135768, - -0.122954223120269076, - -0.152217163962035047, - -0.200495323642697339, - -0.276174333067751758, - -0.393513114304375851, - -0.575754406027879147, - -0.860523235727239756, - -1.308833205758540162 + static_cast(1.375401971871116291), + -static_cast(0.487202183273184837), + -static_cast(0.153311701348540228), + -static_cast(0.111849444917027833), + -static_cast(0.108840952523135768), + -static_cast(0.122954223120269076), + -static_cast(0.152217163962035047), + -static_cast(0.200495323642697339), + -static_cast(0.276174333067751758), + -static_cast(0.393513114304375851), + -static_cast(0.575754406027879147), + -static_cast(0.860523235727239756), + -static_cast(1.308833205758540162) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.45); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.45)); } case 10: case 11: @@ -306,21 +306,21 @@ BOOST_FORCEINLINE T ellint_e_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.325024497958230082, - -0.521727647557566767, - -0.194906430482126213, - -0.171623726822011264, - -0.202754652926419141, - -0.278798953118534762, - -0.420698457281005762, - -0.675948400853106021, - -1.136343121839229244, - -1.976721143954398261, - -3.531696773095722506, - -6.446753640156048150, - -11.97703130208884026 + static_cast(1.325024497958230082), + -static_cast(0.521727647557566767), + -static_cast(0.194906430482126213), + -static_cast(0.171623726822011264), + -static_cast(0.202754652926419141), + -static_cast(0.278798953118534762), + -static_cast(0.420698457281005762), + -static_cast(0.675948400853106021), + -static_cast(1.136343121839229244), + -static_cast(1.976721143954398261), + -static_cast(3.531696773095722506), + -static_cast(6.446753640156048150), + -static_cast(11.97703130208884026) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.55); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.55)); } case 12: case 13: @@ -328,23 +328,23 @@ BOOST_FORCEINLINE T ellint_e_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.270707479650149744, - -0.566839168287866583, - -0.262160793432492598, - -0.292244173533077419, - -0.440397840850423189, - -0.774947641381397458, - -1.498870837987561088, - -3.089708310445186667, - -6.667595903381001064, - -14.89436036517319078, - -34.18120574251449024, - -80.15895841905397306, - -191.3489480762984920, - -463.5938853480342030, - -1137.380822169360061 + static_cast(1.270707479650149744), + -static_cast(0.566839168287866583), + -static_cast(0.262160793432492598), + -static_cast(0.292244173533077419), + -static_cast(0.440397840850423189), + -static_cast(0.774947641381397458), + -static_cast(1.498870837987561088), + -static_cast(3.089708310445186667), + -static_cast(6.667595903381001064), + -static_cast(14.89436036517319078), + -static_cast(34.18120574251449024), + -static_cast(80.15895841905397306), + -static_cast(191.3489480762984920), + -static_cast(463.5938853480342030), + -static_cast(1137.380822169360061) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.65); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.65)); } case 14: case 15: @@ -352,72 +352,72 @@ BOOST_FORCEINLINE T ellint_e_imp(T k, const Policy& pol, std::integral_constant< { constexpr T coef[] = { - 1.211056027568459525, - -0.630306413287455807, - -0.387166409520669145, - -0.592278235311934603, - -1.237555584513049844, - -3.032056661745247199, - -8.181688221573590762, - -23.55507217389693250, - -71.04099935893064956, - -221.8796853192349888, - -712.1364793277635425, - -2336.125331440396407, - -7801.945954775964673, - -26448.19586059191933, - -90799.48341621365251, - -315126.0406449163424, - -1104011.344311591159 + static_cast(1.211056027568459525), + -static_cast(0.630306413287455807), + -static_cast(0.387166409520669145), + -static_cast(0.592278235311934603), + -static_cast(1.237555584513049844), + -static_cast(3.032056661745247199), + -static_cast(8.181688221573590762), + -static_cast(23.55507217389693250), + -static_cast(71.04099935893064956), + -static_cast(221.8796853192349888), + -static_cast(712.1364793277635425), + -static_cast(2336.125331440396407), + -static_cast(7801.945954775964673), + -static_cast(26448.19586059191933), + -static_cast(90799.48341621365251), + -static_cast(315126.0406449163424), + -static_cast(1104011.344311591159) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.75); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.75)); } case 16: //else if (m < 0.85) { constexpr T coef[] = { - 1.161307152196282836, - -0.701100284555289548, - -0.580551474465437362, - -1.243693061077786614, - -3.679383613496634879, - -12.81590924337895775, - -49.25672530759985272, - -202.1818735434090269, - -869.8602699308701437, - -3877.005847313289571, - -17761.70710170939814, - -83182.69029154232061, - -396650.4505013548170, - -1920033.413682634405 + static_cast(1.161307152196282836), + -static_cast(0.701100284555289548), + -static_cast(0.580551474465437362), + -static_cast(1.243693061077786614), + -static_cast(3.679383613496634879), + -static_cast(12.81590924337895775), + -static_cast(49.25672530759985272), + -static_cast(202.1818735434090269), + -static_cast(869.8602699308701437), + -static_cast(3877.005847313289571), + -static_cast(17761.70710170939814), + -static_cast(83182.69029154232061), + -static_cast(396650.4505013548170), + -static_cast(1920033.413682634405) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.825); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.825)); } case 17: //else if (m < 0.90) { constexpr T coef[] = { - 1.124617325119752213, - -0.770845056360909542, - -0.844794053644911362, - -2.490097309450394453, - -10.23971741154384360, - -49.74900546551479866, - -267.0986675195705196, - -1532.665883825229947, - -9222.313478526091951, - -57502.51612140314030, - -368596.1167416106063, - -2415611.088701091428, - -16120097.81581656797, - -109209938.5203089915, - -749380758.1942496220, - -5198725846.725541393, - -36409256888.12139973 + static_cast(1.124617325119752213), + -static_cast(0.770845056360909542), + -static_cast(0.844794053644911362), + -static_cast(2.490097309450394453), + -static_cast(10.23971741154384360), + -static_cast(49.74900546551479866), + -static_cast(267.0986675195705196), + -static_cast(1532.665883825229947), + -static_cast(9222.313478526091951), + -static_cast(57502.51612140314030), + -static_cast(368596.1167416106063), + -static_cast(2415611.088701091428), + -static_cast(16120097.81581656797), + -static_cast(109209938.5203089915), + -static_cast(749380758.1942496220), + -static_cast(5198725846.725541393), + -static_cast(36409256888.12139973) }; - return boost::math::tools::evaluate_polynomial(coef, m - 0.875); + return boost::math::tools::evaluate_polynomial(coef, m - static_cast(0.875)); } default: // diff --git a/include/boost/math/special_functions/hypergeometric_2F0.hpp b/include/boost/math/special_functions/hypergeometric_2F0.hpp index a8ebe2162..5d6e15e27 100644 --- a/include/boost/math/special_functions/hypergeometric_2F0.hpp +++ b/include/boost/math/special_functions/hypergeometric_2F0.hpp @@ -94,7 +94,7 @@ namespace boost { namespace math { namespace detail { // http://functions.wolfram.com/07.31.03.0083.01 int n = static_cast(static_cast(boost::math::lltrunc(-2 * a1))); T smz = sqrt(-z); - return pow(2 / smz, -n) * boost::math::hermite(n, 1 / smz, pol); + return static_cast(pow(2 / smz, -n) * boost::math::hermite(n, 1 / smz, pol)); // Warning suppression: integer power returns at least a double } if (is_a1_integer && is_a2_integer) diff --git a/include/boost/math/special_functions/legendre.hpp b/include/boost/math/special_functions/legendre.hpp index 23f552dc9..6af798e0d 100644 --- a/include/boost/math/special_functions/legendre.hpp +++ b/include/boost/math/special_functions/legendre.hpp @@ -322,7 +322,7 @@ T legendre_p_imp(int l, int m, T x, T sin_theta_power, const Policy& pol) } if (-m == l) { - return pow((1 - x * x) / 4, T(l) / 2) / boost::math::tgamma(l + 1, pol); + return pow((1 - x * x) / 4, T(l) / 2) / boost::math::tgamma(l + 1, pol); } if(m < 0) { diff --git a/include/boost/math/special_functions/owens_t.hpp b/include/boost/math/special_functions/owens_t.hpp index 152b5cbdd..a3879a71c 100644 --- a/include/boost/math/special_functions/owens_t.hpp +++ b/include/boost/math/special_functions/owens_t.hpp @@ -993,7 +993,7 @@ namespace boost const RealType fabs_a = fabs(a); const RealType fabs_ah = fabs_a*h; - RealType val = 0.0; // avoid compiler warnings, 0.0 will be overwritten in any case + RealType val = static_cast(0.0f); // avoid compiler warnings, 0.0 will be overwritten in any case if(fabs_a <= 1) { diff --git a/include/boost/math/special_functions/zeta.hpp b/include/boost/math/special_functions/zeta.hpp index 0f3136d00..c18d2253d 100644 --- a/include/boost/math/special_functions/zeta.hpp +++ b/include/boost/math/special_functions/zeta.hpp @@ -956,9 +956,9 @@ T zeta_imp(T s, T sc, const Policy& pol, const Tag& tag) else if((v & 1) == 0) { if(((v / 2) <= (int)boost::math::max_bernoulli_b2n::value) && (v <= (int)boost::math::max_factorial::value)) - return T(((v / 2 - 1) & 1) ? -1 : 1) * ldexp(T(1), v - 1) * pow(constants::pi(), v) * + return T(((v / 2 - 1) & 1) ? -1 : 1) * ldexp(T(1), v - 1) * static_cast(pow(constants::pi(), v)) * boost::math::unchecked_bernoulli_b2n(v / 2) / boost::math::unchecked_factorial(v); - return T(((v / 2 - 1) & 1) ? -1 : 1) * ldexp(T(1), v - 1) * pow(constants::pi(), v) * + return T(((v / 2 - 1) & 1) ? -1 : 1) * ldexp(T(1), v - 1) * static_cast(pow(constants::pi(), v)) * boost::math::bernoulli_b2n(v / 2) / boost::math::factorial(v, pol); } else diff --git a/test/compile_test/test_promote_args.cpp b/test/compile_test/test_promote_args.cpp index c54117c13..2281aa711 100644 --- a/test/compile_test/test_promote_args.cpp +++ b/test/compile_test/test_promote_args.cpp @@ -5,7 +5,9 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #include +#ifndef BOOST_MATH_STANDALONE #include +#endif #include #if __has_include() @@ -16,7 +18,7 @@ int main() { using boost::math::tools::promote_args_t; -#if defined(__cpp_lib_type_trait_variable_templates) +#if defined(__cpp_lib_type_trait_variable_templates) && (__cpp_lib_type_trait_variable_templates >= 201510L) && defined(__cpp_static_assert) && (__cpp_static_assert >= 201411L) static_assert(std::is_same_v, long double>); static_assert(std::is_same_v, long double>); @@ -162,6 +164,7 @@ int main() #endif #endif +#ifndef BOOST_MATH_STANDALONE static_assert(std::is_same_v, boost::multiprecision::cpp_bin_float_50>); static_assert(std::is_same_v, boost::multiprecision::cpp_bin_float_50>); static_assert(std::is_same_v, boost::multiprecision::cpp_bin_float_50>); @@ -177,6 +180,7 @@ int main() #ifdef __STDCPP_FLOAT128_T__ static_assert(std::is_same_v, boost::multiprecision::cpp_bin_float_50>); #endif +#endif // BOOST_MATH_STANDALONE #endif