Skip to content

Commit 5a30520

Browse files
committed
Merge remote-tracking branch 'origin' into mydevelop
2 parents 517212e + 9f03f29 commit 5a30520

71 files changed

Lines changed: 1433 additions & 1259 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/boost/math/constants/info.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
#include <boost/math/constants/constants.hpp>
1414
#include <iostream>
1515
#include <iomanip>
16+
#ifndef BOOST_MATH_NO_RTTI
1617
#include <typeinfo>
18+
#endif
1719

1820
namespace boost{ namespace math{ namespace constants{
1921

@@ -22,7 +24,11 @@ namespace boost{ namespace math{ namespace constants{
2224
template <class T>
2325
const char* nameof(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T))
2426
{
27+
#ifndef BOOST_MATH_NO_RTTI
2528
return typeid(T).name();
29+
#else
30+
return "unknown";
31+
#endif
2632
}
2733
template <>
2834
const char* nameof<float>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(float))

include/boost/math/distributions/landau.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3382,7 +3382,7 @@ BOOST_MATH_GPU_ENABLED inline RealType landau_quantile_lower_imp_prec(const Real
33823382

33833383
// Rational Approximation
33843384
// Maximum Relative Error: 5.3064e-35
3385-
//LCOV_EXCL_START
3385+
// LCOV_EXCL_START
33863386
BOOST_MATH_STATIC const RealType P[14] = {
33873387
BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.09971143249822249471944441552701756051e0),
33883388
BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.00154235169065403254826962372636417554e-2),

include/boost/math/policies/error_handling.hpp

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,32 @@
88
#ifndef BOOST_MATH_POLICY_ERROR_HANDLING_HPP
99
#define BOOST_MATH_POLICY_ERROR_HANDLING_HPP
1010

11+
#include <boost/math/policies/policy.hpp>
1112
#include <boost/math/tools/config.hpp>
1213
#include <boost/math/tools/numeric_limits.hpp>
13-
#include <boost/math/tools/type_traits.hpp>
14-
#include <boost/math/tools/cstdint.hpp>
15-
#include <boost/math/tools/tuple.hpp>
16-
#include <boost/math/policies/policy.hpp>
1714
#include <boost/math/tools/precision.hpp>
15+
#include <boost/math/tools/tuple.hpp>
16+
#include <boost/math/tools/type_traits.hpp>
1817

1918
#ifndef BOOST_MATH_HAS_NVRTC
2019

21-
#include <iomanip>
22-
#include <string>
23-
#include <cstring>
24-
#ifndef BOOST_MATH_NO_RTTI
25-
#include <typeinfo>
20+
#ifndef BOOST_MATH_NO_EXCEPTIONS
21+
#include <boost/math/tools/throw_exception.hpp>
2622
#endif
23+
2724
#include <cerrno>
28-
#include <complex>
2925
#include <cmath>
26+
#include <complex>
3027
#include <cstdint>
28+
#include <cstring>
29+
#include <iomanip>
30+
#include <sstream>
3131
#ifndef BOOST_MATH_NO_EXCEPTIONS
3232
#include <stdexcept>
33-
#include <boost/math/tools/throw_exception.hpp>
33+
#endif
34+
#include <string>
35+
#ifndef BOOST_MATH_NO_RTTI
36+
#include <typeinfo>
3437
#endif
3538

3639
#ifdef _MSC_VER
@@ -43,7 +46,6 @@
4346
// Note that this only occurs when the compiler can deduce code is unreachable,
4447
// for example when policy macros are used to ignore errors rather than throw.
4548
#endif
46-
#include <sstream>
4749

4850
namespace boost{ namespace math{
4951

@@ -91,15 +93,20 @@ namespace detail
9193
template <class T>
9294
inline std::string prec_format(const T& val)
9395
{
94-
typedef typename boost::math::policies::precision<T, boost::math::policies::policy<> >::type prec_type;
95-
std::stringstream ss;
96+
using prec_type = typename boost::math::policies::precision<T, boost::math::policies::policy<> >::type;
97+
98+
std::stringstream strm { };
99+
96100
if(prec_type::value)
97101
{
98-
int prec = 2 + (prec_type::value * 30103UL) / 100000UL;
99-
ss << std::setprecision(prec);
102+
const std::streamsize prec { static_cast<std::streamsize>(2UL + (prec_type::value * 30103UL) / 100000UL) };
103+
104+
strm << std::setprecision(prec);
100105
}
101-
ss << val;
102-
return ss.str();
106+
107+
strm << val;
108+
109+
return strm.str();
103110
}
104111

105112
#ifdef BOOST_MATH_USE_CHARCONV_FOR_CONVERSION

include/boost/math/policies/policy.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ namespace policies{
132132

133133
#define BOOST_MATH_META_INT(Type, name, Default) \
134134
template <Type N = Default> \
135-
class name : public boost::math::integral_constant<int, N>{}; \
135+
class name : public boost::math::integral_constant<Type, N> { }; \
136136
\
137137
namespace detail{ \
138138
template <Type N> \

include/boost/math/special_functions/bessel.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ BOOST_MATH_GPU_ENABLED inline T cyl_neumann_zero_imp(T v, int m, const Policy& p
524524

525525
if(number_of_iterations >= policies::get_max_root_iterations<Policy>())
526526
{
527-
return policies::raise_evaluation_error<T>(function, "Unable to locate root in a reasonable time: Current best guess is %1%", yvm, Policy()); //LCOV_EXCL_LINE
527+
return policies::raise_evaluation_error<T>(function, "Unable to locate root in a reasonable time: Current best guess is %1%", yvm, Policy()); // LCOV_EXCL_LINE
528528
}
529529

530530
return yvm;

include/boost/math/special_functions/beta.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,15 @@ BOOST_MATH_GPU_ENABLED T ibeta_series(T a, T b, T x, T s0, const Lanczos&, bool
683683
if ((a < tools::min_value<T>()) || (b < tools::min_value<T>()))
684684
result = 0; // denorms cause overflow in the Lanzos series, result will be zero anyway
685685
else
686-
result = Lanczos::lanczos_sum_expG_scaled(c) / (Lanczos::lanczos_sum_expG_scaled(a) * Lanczos::lanczos_sum_expG_scaled(b));
686+
{
687+
T l1 = Lanczos::lanczos_sum_expG_scaled(c);
688+
T l2 = Lanczos::lanczos_sum_expG_scaled(a);
689+
T l3 = Lanczos::lanczos_sum_expG_scaled(b);
690+
if ((l2 > 1) && (l3 > 1) && (tools::max_value<T>() / l2 < l3))
691+
result = (l1 / l2) / l3;
692+
else
693+
result = l1 / (l2 * l3);
694+
}
687695

688696
if (!(boost::math::isfinite)(result))
689697
result = 0; // LCOV_EXCL_LINE we can probably never get here, covered already above?

include/boost/math/special_functions/detail/bernoulli_details.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ inline std::size_t find_bernoulli_overflow_limit(const std::false_type&)
108108
// Set a limit on how large the result can ever be:
109109
static const auto max_result = static_cast<double>((std::numeric_limits<std::size_t>::max)() - 1000u);
110110

111-
unsigned long long t = lltrunc(boost::math::tools::log_max_value<T>());
111+
unsigned long long t = static_cast<unsigned long long>(lltrunc(boost::math::tools::log_max_value<T>()));
112112
max_bernoulli_root_functor fun(t);
113113
boost::math::tools::equal_floor tol;
114114
std::uintmax_t max_iter = boost::math::policies::get_max_root_iterations<Policy>();
@@ -372,7 +372,7 @@ class bernoulli_numbers_cache
372372
{
373373
for(; n; ++start, --n)
374374
{
375-
*out = b2n_asymptotic<T, Policy>(static_cast<typename container_type::size_type>(start * 2U));
375+
*out = b2n_asymptotic<T, Policy>(static_cast<int>(start * 2U));
376376
++out;
377377
}
378378
}

include/boost/math/special_functions/detail/bessel_ik.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ BOOST_MATH_GPU_ENABLED int bessel_ik(T v, T x, T* result_I, T* result_K, int kin
416416
else
417417
Iv = boost::math::numeric_limits<T>::quiet_NaN(); // any value will do
418418
}
419-
if (reflect)
419+
if (reflect && (kind & need_i))
420420
{
421421
BOOST_MATH_ASSERT(fabs(v - n - u) < tools::forth_root_epsilon<T>());
422422
T z = (u + n % 2);

include/boost/math/special_functions/detail/bessel_j1.hpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,41 +32,9 @@
3232

3333
namespace boost { namespace math{ namespace detail{
3434

35-
template <typename T>
36-
BOOST_MATH_GPU_ENABLED T bessel_j1(T x);
37-
38-
template <class T>
39-
struct bessel_j1_initializer
40-
{
41-
struct init
42-
{
43-
BOOST_MATH_GPU_ENABLED init()
44-
{
45-
do_init();
46-
}
47-
BOOST_MATH_GPU_ENABLED static void do_init()
48-
{
49-
bessel_j1(T(1));
50-
}
51-
BOOST_MATH_GPU_ENABLED void force_instantiate()const{}
52-
};
53-
BOOST_MATH_STATIC const init initializer;
54-
BOOST_MATH_GPU_ENABLED static void force_instantiate()
55-
{
56-
#ifndef BOOST_MATH_HAS_GPU_SUPPORT
57-
initializer.force_instantiate();
58-
#endif
59-
}
60-
};
61-
62-
template <class T>
63-
const typename bessel_j1_initializer<T>::init bessel_j1_initializer<T>::initializer;
64-
6535
template <typename T>
6636
BOOST_MATH_GPU_ENABLED T bessel_j1(T x)
6737
{
68-
bessel_j1_initializer<T>::force_instantiate();
69-
7038
BOOST_MATH_STATIC const T P1[] = {
7139
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.4258509801366645672e+11)),
7240
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 6.6781041261492395835e+09)),

include/boost/math/special_functions/detail/bessel_jn.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ BOOST_MATH_GPU_ENABLED T bessel_jn(int n, T x, const Policy& pol)
7676
{
7777
prev = bessel_j0(x);
7878
current = bessel_j1(x);
79-
policies::check_series_iterations<T>("boost::math::bessel_j_n<%1%>(%1%,%1%)", n, pol);
79+
policies::check_series_iterations<T>("boost::math::bessel_j_n<%1%>(%1%,%1%)", static_cast<unsigned>(n), pol);
8080
for (int k = 1; k < n; k++)
8181
{
8282
value = (2 * k * current / x) - prev;
@@ -96,7 +96,7 @@ BOOST_MATH_GPU_ENABLED T bessel_jn(int n, T x, const Policy& pol)
9696
prev = fn;
9797
current = 1;
9898
// Check recursion won't go on too far:
99-
policies::check_series_iterations<T>("boost::math::bessel_j_n<%1%>(%1%,%1%)", n, pol);
99+
policies::check_series_iterations<T>("boost::math::bessel_j_n<%1%>(%1%,%1%)", static_cast<unsigned>(n), pol);
100100
for (int k = n; k > 0; k--)
101101
{
102102
T fact = 2 * k / x;

0 commit comments

Comments
 (0)