Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:40:39

0001 //  Copyright (c) 2006-7 John Maddock
0002 //  Copyright (c) 2021 Matt Borland
0003 //  Use, modification and distribution are subject to the
0004 //  Boost Software License, Version 1.0. (See accompanying file
0005 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_MATH_TOOLS_CONFIG_HPP
0008 #define BOOST_MATH_TOOLS_CONFIG_HPP
0009 
0010 #ifdef _MSC_VER
0011 #pragma once
0012 #endif
0013 
0014 #ifndef __CUDACC_RTC__
0015 
0016 #include <boost/math/tools/is_standalone.hpp>
0017 
0018 // Minimum language standard transition
0019 #ifdef _MSVC_LANG
0020 #  if _MSVC_LANG < 201402L
0021 #    pragma message("Boost.Math requires C++14");
0022 #  endif
0023 #  if _MSC_VER == 1900
0024 #    pragma message("MSVC 14.0 has broken C++14 constexpr support. Support for this compiler will be removed in Boost 1.86")
0025 #  endif
0026 #else
0027 #  if __cplusplus < 201402L
0028 #    warning "Boost.Math requires C++14"
0029 #  endif
0030 #endif
0031 
0032 #ifndef BOOST_MATH_STANDALONE
0033 #include <boost/config.hpp>
0034 
0035 
0036 // The following are all defined as standalone macros as well
0037 // If Boost.Config is available just use those definitions because they are more fine-grained
0038 
0039 // Could be defined in TR1
0040 #ifndef BOOST_MATH_PREVENT_MACRO_SUBSTITUTION
0041 #  define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION BOOST_PREVENT_MACRO_SUBSTITUTION
0042 #endif
0043 
0044 #define BOOST_MATH_CXX14_CONSTEXPR BOOST_CXX14_CONSTEXPR
0045 #ifdef BOOST_NO_CXX14_CONSTEXPR
0046 #  define BOOST_MATH_NO_CXX14_CONSTEXPR
0047 #endif
0048 
0049 #define BOOST_MATH_IF_CONSTEXPR BOOST_IF_CONSTEXPR
0050 #ifdef BOOST_NO_CXX17_IF_CONSTEXPR
0051 #  define BOOST_MATH_NO_CXX17_IF_CONSTEXPR
0052 #endif
0053 
0054 #ifdef BOOST_NO_CXX17_HDR_EXECUTION
0055 #  define BOOST_MATH_NO_CXX17_HDR_EXECUTION
0056 #endif
0057 
0058 #ifdef BOOST_HAS_THREADS
0059 #  define BOOST_MATH_HAS_THREADS
0060 #endif
0061 #ifdef BOOST_DISABLE_THREADS
0062 #  define BOOST_MATH_DISABLE_THREADS
0063 #endif
0064 #ifdef BOOST_NO_CXX11_THREAD_LOCAL
0065 #  define BOOST_MATH_NO_CXX11_THREAD_LOCAL
0066 #endif
0067 
0068 #ifdef BOOST_NO_EXCEPTIONS
0069 #  define BOOST_MATH_NO_EXCEPTIONS
0070 #endif
0071 
0072 #ifdef BOOST_NO_TYPEID
0073 #  define BOOST_MATH_NO_TYPEID
0074 #endif
0075 #ifdef BOOST_NO_RTTI
0076 #  define BOOST_MATH_NO_RTTI
0077 #endif
0078 
0079 #define BOOST_MATH_NOINLINE BOOST_NOINLINE
0080 #define BOOST_MATH_FORCEINLINE BOOST_FORCEINLINE
0081 
0082 #define BOOST_MATH_JOIN(X, Y) BOOST_JOIN(X, Y)
0083 #define BOOST_MATH_STRINGIZE(X) BOOST_STRINGIZE(X)
0084 
0085 #else // Things from boost/config that are required, and easy to replicate
0086 
0087 #define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION
0088 #define BOOST_MATH_NO_REAL_CONCEPT_TESTS
0089 #define BOOST_MATH_NO_DISTRIBUTION_CONCEPT_TESTS
0090 #define BOOST_MATH_NO_LEXICAL_CAST
0091 
0092 // Since Boost.Multiprecision is in active development some tests do not fully cooperate yet.
0093 #define BOOST_MATH_NO_MP_TESTS
0094 
0095 #if (__cplusplus > 201400L || _MSVC_LANG > 201400L)
0096 #define BOOST_MATH_CXX14_CONSTEXPR constexpr
0097 #else
0098 #define BOOST_MATH_CXX14_CONSTEXPR
0099 #define BOOST_MATH_NO_CXX14_CONSTEXPR
0100 #endif // BOOST_MATH_CXX14_CONSTEXPR
0101 
0102 #if (__cplusplus > 201700L || _MSVC_LANG > 201700L)
0103 #define BOOST_MATH_IF_CONSTEXPR if constexpr
0104 
0105 // Clang on mac provides the execution header with none of the functionality. TODO: Check back on this
0106 // https://en.cppreference.com/w/cpp/compiler_support "Standardization of Parallelism TS"
0107 #  if !__has_include(<execution>) || (defined(__APPLE__) && defined(__clang__))
0108 #  define BOOST_MATH_NO_CXX17_HDR_EXECUTION
0109 #  endif
0110 #else
0111 #  define BOOST_MATH_IF_CONSTEXPR if
0112 #  define BOOST_MATH_NO_CXX17_IF_CONSTEXPR
0113 #  define BOOST_MATH_NO_CXX17_HDR_EXECUTION
0114 #endif
0115 
0116 #if __cpp_lib_gcd_lcm >= 201606L
0117 #define BOOST_MATH_HAS_CXX17_NUMERIC
0118 #endif
0119 
0120 #define BOOST_MATH_JOIN(X, Y) BOOST_MATH_DO_JOIN(X, Y)
0121 #define BOOST_MATH_DO_JOIN(X, Y) BOOST_MATH_DO_JOIN2(X,Y)
0122 #define BOOST_MATH_DO_JOIN2(X, Y) X##Y
0123 
0124 #define BOOST_MATH_STRINGIZE(X) BOOST_MATH_DO_STRINGIZE(X)
0125 #define BOOST_MATH_DO_STRINGIZE(X) #X
0126 
0127 #ifdef BOOST_MATH_DISABLE_THREADS // No threads, do nothing
0128 // Detect thread support via STL implementation
0129 #elif defined(__has_include)
0130 #  if !__has_include(<thread>) || !__has_include(<mutex>) || !__has_include(<future>) || !__has_include(<atomic>)
0131 #     define BOOST_MATH_DISABLE_THREADS
0132 #  else
0133 #     define BOOST_MATH_HAS_THREADS
0134 #  endif 
0135 #else
0136 #  define BOOST_MATH_HAS_THREADS // The default assumption is that the machine has threads
0137 #endif // Thread Support
0138 
0139 #ifdef BOOST_MATH_DISABLE_THREADS
0140 #  define BOOST_MATH_NO_CXX11_THREAD_LOCAL
0141 #endif // BOOST_MATH_DISABLE_THREADS
0142 
0143 #ifdef __GNUC__
0144 #  if !defined(__EXCEPTIONS) && !defined(BOOST_MATH_NO_EXCEPTIONS)
0145 #     define BOOST_MATH_NO_EXCEPTIONS
0146 #  endif
0147    //
0148    // Make sure we have some std lib headers included so we can detect __GXX_RTTI:
0149    //
0150 #  include <algorithm>  // for min and max
0151 #  include <limits>
0152 #  ifndef __GXX_RTTI
0153 #     ifndef BOOST_MATH_NO_TYPEID
0154 #        define BOOST_MATH_NO_TYPEID
0155 #     endif
0156 #     ifndef BOOST_MATH_NO_RTTI
0157 #        define BOOST_MATH_NO_RTTI
0158 #     endif
0159 #  endif
0160 #endif
0161 
0162 #if !defined(BOOST_MATH_NOINLINE)
0163 #  if defined(_MSC_VER)
0164 #    define BOOST_MATH_NOINLINE __declspec(noinline)
0165 #  elif defined(__GNUC__) && __GNUC__ > 3
0166      // Clang also defines __GNUC__ (as 4)
0167 #    if defined(__CUDACC__)
0168        // nvcc doesn't always parse __noinline__,
0169        // see: https://svn.boost.org/trac/boost/ticket/9392
0170 #      define BOOST_MATH_NOINLINE __attribute__ ((noinline))
0171 #    elif defined(__HIP__)
0172        // See https://github.com/boostorg/config/issues/392
0173 #      define BOOST_MATH_NOINLINE __attribute__ ((noinline))
0174 #    else
0175 #      define BOOST_MATH_NOINLINE __attribute__ ((__noinline__))
0176 #    endif
0177 #  else
0178 #    define BOOST_MATH_NOINLINE
0179 #  endif
0180 #endif
0181 
0182 #if !defined(BOOST_MATH_FORCEINLINE)
0183 #  if defined(_MSC_VER)
0184 #    define BOOST_MATH_FORCEINLINE __forceinline
0185 #  elif defined(__GNUC__) && __GNUC__ > 3
0186      // Clang also defines __GNUC__ (as 4)
0187 #    define BOOST_MATH_FORCEINLINE inline __attribute__ ((__always_inline__))
0188 #  else
0189 #    define BOOST_MATH_FORCEINLINE inline
0190 #  endif
0191 #endif
0192 
0193 #endif // BOOST_MATH_STANDALONE
0194 
0195 // Support compilers with P0024R2 implemented without linking TBB
0196 // https://en.cppreference.com/w/cpp/compiler_support
0197 #if !defined(BOOST_MATH_NO_CXX17_HDR_EXECUTION) && defined(BOOST_MATH_HAS_THREADS)
0198 #  define BOOST_MATH_EXEC_COMPATIBLE
0199 #endif
0200 
0201 // C++23
0202 #if __cplusplus > 202002L || (defined(_MSVC_LANG) &&_MSVC_LANG > 202002L)
0203 #  if __GNUC__ >= 13
0204      // libstdc++3 only defines to/from_chars for std::float128_t when one of these defines are set
0205      // otherwise we're right out of luck...
0206 #    if defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) || defined(_GLIBCXX_HAVE_FLOAT128_MATH)
0207 #      include <cstring> // std::strlen is used with from_chars
0208 #      include <charconv>
0209 #      include <stdfloat>
0210 #      define BOOST_MATH_USE_CHARCONV_FOR_CONVERSION
0211 #    endif
0212 #  endif
0213 #endif
0214 
0215 #include <algorithm>  // for min and max
0216 #include <limits>
0217 #include <cmath>
0218 #include <climits>
0219 #include <cfloat>
0220 
0221 #include <boost/math/tools/user.hpp>
0222 
0223 #if (defined(__NetBSD__)\
0224    || (defined(__hppa) && !defined(__OpenBSD__)) || (defined(__NO_LONG_DOUBLE_MATH) && (DBL_MANT_DIG != LDBL_MANT_DIG))) \
0225    && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
0226 //#  define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
0227 #endif
0228 
0229 #if defined(__EMSCRIPTEN__) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
0230 #  define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
0231 #endif
0232 
0233 #ifdef __IBMCPP__
0234 //
0235 // For reasons I don't understand, the tests with IMB's compiler all
0236 // pass at long double precision, but fail with real_concept, those tests
0237 // are disabled for now.  (JM 2012).
0238 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
0239 #  define BOOST_MATH_NO_REAL_CONCEPT_TESTS
0240 #endif // BOOST_MATH_NO_REAL_CONCEPT_TESTS
0241 #endif
0242 #ifdef sun
0243 // Any use of __float128 in program startup code causes a segfault  (tested JM 2015, Solaris 11).
0244 #  define BOOST_MATH_DISABLE_FLOAT128
0245 #endif
0246 #ifdef __HAIKU__
0247 //
0248 // Not sure what's up with the math detection on Haiku, but linking fails with
0249 // float128 code enabled, and we don't have an implementation of __expl, so
0250 // disabling long double functions for now as well.
0251 #  define BOOST_MATH_DISABLE_FLOAT128
0252 #  define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
0253 #endif
0254 #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
0255 //
0256 // Darwin's rather strange "double double" is rather hard to
0257 // support, it should be possible given enough effort though...
0258 //
0259 #  define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
0260 #endif
0261 #if !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) && (LDBL_MANT_DIG == 106) && (LDBL_MIN_EXP > DBL_MIN_EXP)
0262 //
0263 // Generic catch all case for gcc's "double-double" long double type.
0264 // We do not support this as it's not even remotely IEEE conforming:
0265 //
0266 #  define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
0267 #endif
0268 #if defined(unix) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER <= 1000) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
0269 //
0270 // Intel compiler prior to version 10 has sporadic problems
0271 // calling the long double overloads of the std lib math functions:
0272 // calling ::powl is OK, but std::pow(long double, long double) 
0273 // may segfault depending upon the value of the arguments passed 
0274 // and the specific Linux distribution.
0275 //
0276 // We'll be conservative and disable long double support for this compiler.
0277 //
0278 // Comment out this #define and try building the tests to determine whether
0279 // your Intel compiler version has this issue or not.
0280 //
0281 #  define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
0282 #endif
0283 #if defined(unix) && defined(__INTEL_COMPILER)
0284 //
0285 // Intel compiler has sporadic issues compiling std::fpclassify depending on
0286 // the exact OS version used.  Use our own code for this as we know it works
0287 // well on Intel processors:
0288 //
0289 #define BOOST_MATH_DISABLE_STD_FPCLASSIFY
0290 #endif
0291 
0292 #if defined(_MSC_VER) && !defined(_WIN32_WCE)
0293    // Better safe than sorry, our tests don't support hardware exceptions:
0294 #  define BOOST_MATH_CONTROL_FP _control87(MCW_EM,MCW_EM)
0295 #endif
0296 
0297 #ifdef __IBMCPP__
0298 #  define BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS
0299 #endif
0300 
0301 #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901))
0302 #  define BOOST_MATH_USE_C99
0303 #endif
0304 
0305 #if (defined(__hpux) && !defined(__hppa))
0306 #  define BOOST_MATH_USE_C99
0307 #endif
0308 
0309 #if defined(__GNUC__) && defined(_GLIBCXX_USE_C99)
0310 #  define BOOST_MATH_USE_C99
0311 #endif
0312 
0313 #if defined(_LIBCPP_VERSION) && !defined(_MSC_VER)
0314 #  define BOOST_MATH_USE_C99
0315 #endif
0316 
0317 #if defined(__CYGWIN__) || defined(__HP_aCC) || defined(__INTEL_COMPILER) \
0318   || defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \
0319   || (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99))\
0320   || defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
0321 #  define BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY
0322 #endif
0323 
0324 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x590)
0325 
0326 namespace boost { namespace math { namespace tools { namespace detail {
0327 template <typename T>
0328 struct type {};
0329 
0330 template <typename T, T n>
0331 struct non_type {};
0332 }}}} // Namespace boost, math tools, detail
0333 
0334 #  define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)              boost::math::tools::detail::type<t>* = 0
0335 #  define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)         boost::math::tools::detail::type<t>*
0336 #  define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)       boost::math::tools::detail::non_type<t, v>* = 0
0337 #  define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)  boost::math::tools::detail::non_type<t, v>*
0338 
0339 #  define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t)         \
0340              , BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
0341 #  define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)    \
0342              , BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
0343 #  define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)  \
0344              , BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
0345 #  define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)  \
0346              , BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
0347 
0348 #else
0349 
0350 // no workaround needed: expand to nothing
0351 
0352 #  define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
0353 #  define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
0354 #  define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
0355 #  define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
0356 
0357 #  define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
0358 #  define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
0359 #  define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
0360 #  define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
0361 
0362 
0363 #endif // __SUNPRO_CC
0364 
0365 #if (defined(__SUNPRO_CC) || defined(__hppa) || defined(__GNUC__)) && !defined(BOOST_MATH_SMALL_CONSTANT)
0366 // Sun's compiler emits a hard error if a constant underflows,
0367 // as does aCC on PA-RISC, while gcc issues a large number of warnings:
0368 #  define BOOST_MATH_SMALL_CONSTANT(x) 0.0
0369 #else
0370 #  define BOOST_MATH_SMALL_CONSTANT(x) x
0371 #endif
0372 
0373 //
0374 // Tune performance options for specific compilers,
0375 // but check at each step that nothing has been previously defined by the user first
0376 //
0377 #ifdef _MSC_VER
0378 #  ifndef BOOST_MATH_POLY_METHOD
0379 #    define BOOST_MATH_POLY_METHOD 2
0380 #  endif
0381 #if _MSC_VER <= 1900
0382 #  ifndef BOOST_MATH_POLY_METHOD
0383 #    define BOOST_MATH_RATIONAL_METHOD 1
0384 #  endif
0385 #else
0386 #  ifndef BOOST_MATH_RATIONAL_METHOD
0387 #    define BOOST_MATH_RATIONAL_METHOD 2
0388 #  endif
0389 #endif
0390 #if _MSC_VER > 1900
0391 #  ifndef BOOST_MATH_INT_TABLE_TYPE
0392 #    define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT
0393 #  endif
0394 #  ifndef BOOST_MATH_INT_VALUE_SUFFIX
0395 #    define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L
0396 #  endif
0397 #endif
0398 
0399 #elif defined(__INTEL_COMPILER)
0400 #  ifndef BOOST_MATH_POLY_METHOD
0401 #    define BOOST_MATH_POLY_METHOD 2
0402 #  endif
0403 #  ifndef BOOST_MATH_RATIONAL_METHOD
0404 #    define BOOST_MATH_RATIONAL_METHOD 1
0405 #  endif
0406 
0407 #elif defined(__GNUC__)
0408 #  ifndef BOOST_MATH_POLY_METHOD
0409 #    define BOOST_MATH_POLY_METHOD 3
0410 #  endif
0411 #  ifndef BOOST_MATH_RATIONAL_METHOD
0412 #    define BOOST_MATH_RATIONAL_METHOD 3
0413 #  endif
0414 
0415 #elif defined(__clang__)
0416 
0417 #if __clang__ > 6
0418 #  ifndef BOOST_MATH_POLY_METHOD
0419 #    define BOOST_MATH_POLY_METHOD 3
0420 #  endif
0421 #  ifndef BOOST_MATH_RATIONAL_METHOD
0422 #    define BOOST_MATH_RATIONAL_METHOD 3
0423 #  endif
0424 #  ifndef BOOST_MATH_INT_TABLE_TYPE
0425 #    define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT
0426 #  endif
0427 #  ifndef BOOST_MATH_INT_VALUE_SUFFIX
0428 #    define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L
0429 #  endif
0430 #endif
0431 
0432 #endif
0433 
0434 //
0435 // noexcept support:
0436 //
0437 #include <type_traits>
0438 #define BOOST_MATH_NOEXCEPT(T) noexcept(std::is_floating_point<T>::value)
0439 #define BOOST_MATH_IS_FLOAT(T) (std::is_floating_point<T>::value)
0440 
0441 //
0442 // The maximum order of polynomial that will be evaluated 
0443 // via an unrolled specialisation:
0444 //
0445 #ifndef BOOST_MATH_MAX_POLY_ORDER
0446 #  define BOOST_MATH_MAX_POLY_ORDER 20
0447 #endif 
0448 //
0449 // Set the method used to evaluate polynomials and rationals:
0450 //
0451 #ifndef BOOST_MATH_POLY_METHOD
0452 #  define BOOST_MATH_POLY_METHOD 2
0453 #endif 
0454 #ifndef BOOST_MATH_RATIONAL_METHOD
0455 #  define BOOST_MATH_RATIONAL_METHOD 1
0456 #endif 
0457 //
0458 // decide whether to store constants as integers or reals:
0459 //
0460 #ifndef BOOST_MATH_INT_TABLE_TYPE
0461 #  define BOOST_MATH_INT_TABLE_TYPE(RT, IT) IT
0462 #endif
0463 #ifndef BOOST_MATH_INT_VALUE_SUFFIX
0464 #  define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF
0465 #endif
0466 //
0467 // And then the actual configuration:
0468 //
0469 #if defined(BOOST_MATH_STANDALONE) && defined(_GLIBCXX_USE_FLOAT128) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) && !defined(__STRICT_ANSI__) \
0470    && !defined(BOOST_MATH_DISABLE_FLOAT128) && !defined(BOOST_MATH_USE_FLOAT128)
0471 #  define BOOST_MATH_USE_FLOAT128
0472 #elif defined(BOOST_HAS_FLOAT128) && !defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_MATH_DISABLE_FLOAT128)
0473 #  define BOOST_MATH_USE_FLOAT128
0474 #endif
0475 #ifdef BOOST_MATH_USE_FLOAT128
0476 //
0477 // Only enable this when the compiler really is GCC as clang and probably 
0478 // intel too don't support __float128 yet :-(
0479 //
0480 #  if defined(__INTEL_COMPILER) && defined(__GNUC__)
0481 #    if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
0482 #      define BOOST_MATH_FLOAT128_TYPE __float128
0483 #    endif
0484 #  elif defined(__GNUC__)
0485 #      define BOOST_MATH_FLOAT128_TYPE __float128
0486 #  endif
0487 
0488 #  ifndef BOOST_MATH_FLOAT128_TYPE
0489 #      define BOOST_MATH_FLOAT128_TYPE _Quad
0490 #  endif
0491 #endif
0492 //
0493 // Check for WinCE with no iostream support:
0494 //
0495 #if defined(_WIN32_WCE) && !defined(__SGI_STL_PORT)
0496 #  define BOOST_MATH_NO_LEXICAL_CAST
0497 #endif
0498 
0499 //
0500 // Helper macro for controlling the FP behaviour:
0501 //
0502 #ifndef BOOST_MATH_CONTROL_FP
0503 #  define BOOST_MATH_CONTROL_FP
0504 #endif
0505 //
0506 // Helper macro for using statements:
0507 //
0508 #define BOOST_MATH_STD_USING_CORE \
0509    using std::abs;\
0510    using std::acos;\
0511    using std::cos;\
0512    using std::fmod;\
0513    using std::modf;\
0514    using std::tan;\
0515    using std::asin;\
0516    using std::cosh;\
0517    using std::frexp;\
0518    using std::pow;\
0519    using std::tanh;\
0520    using std::atan;\
0521    using std::exp;\
0522    using std::ldexp;\
0523    using std::sin;\
0524    using std::atan2;\
0525    using std::fabs;\
0526    using std::log;\
0527    using std::sinh;\
0528    using std::ceil;\
0529    using std::floor;\
0530    using std::log10;\
0531    using std::sqrt;\
0532    using std::log2;\
0533    using std::ilogb;
0534 
0535 #define BOOST_MATH_STD_USING BOOST_MATH_STD_USING_CORE
0536 
0537 namespace boost{ namespace math{
0538 namespace tools
0539 {
0540 
0541 template <class T>
0542 inline T max BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c) BOOST_MATH_NOEXCEPT(T)
0543 {
0544    return (std::max)((std::max)(a, b), c);
0545 }
0546 
0547 template <class T>
0548 inline T max BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c, T d) BOOST_MATH_NOEXCEPT(T)
0549 {
0550    return (std::max)((std::max)(a, b), (std::max)(c, d));
0551 }
0552 
0553 } // namespace tools
0554 
0555 template <class T>
0556 void suppress_unused_variable_warning(const T&) BOOST_MATH_NOEXCEPT(T)
0557 {
0558 }
0559 
0560 namespace detail{
0561 
0562 template <class T>
0563 struct is_integer_for_rounding
0564 {
0565    static constexpr bool value = std::is_integral<T>::value || (std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer);
0566 };
0567 
0568 }
0569 
0570 }} // namespace boost namespace math
0571 
0572 #ifdef __GLIBC_PREREQ
0573 #  if __GLIBC_PREREQ(2,14)
0574 #     define BOOST_MATH_HAVE_FIXED_GLIBC
0575 #  endif
0576 #endif
0577 
0578 #if ((defined(__linux__) && !defined(__UCLIBC__) && !defined(BOOST_MATH_HAVE_FIXED_GLIBC)) || defined(__QNX__) || defined(__IBMCPP__))
0579 //
0580 // This code was introduced in response to this glibc bug: http://sourceware.org/bugzilla/show_bug.cgi?id=2445
0581 // Basically powl and expl can return garbage when the result is small and certain exception flags are set
0582 // on entrance to these functions.  This appears to have been fixed in Glibc 2.14 (May 2011).
0583 // Much more information in this message thread: https://groups.google.com/forum/#!topic/boost-list/ZT99wtIFlb4
0584 //
0585 
0586 #include <cfenv>
0587 
0588 #  ifdef FE_ALL_EXCEPT
0589 
0590 namespace boost{ namespace math{
0591    namespace detail
0592    {
0593    struct fpu_guard
0594    {
0595       fpu_guard()
0596       {
0597          fegetexceptflag(&m_flags, FE_ALL_EXCEPT);
0598          feclearexcept(FE_ALL_EXCEPT);
0599       }
0600       ~fpu_guard()
0601       {
0602          fesetexceptflag(&m_flags, FE_ALL_EXCEPT);
0603       }
0604    private:
0605       fexcept_t m_flags;
0606    };
0607 
0608    } // namespace detail
0609    }} // namespaces
0610 
0611 #    define BOOST_FPU_EXCEPTION_GUARD boost::math::detail::fpu_guard local_guard_object;
0612 #    define BOOST_MATH_INSTRUMENT_FPU do{ fexcept_t cpu_flags; fegetexceptflag(&cpu_flags, FE_ALL_EXCEPT); BOOST_MATH_INSTRUMENT_VARIABLE(cpu_flags); } while(0); 
0613 
0614 #  else
0615 
0616 #    define BOOST_FPU_EXCEPTION_GUARD
0617 #    define BOOST_MATH_INSTRUMENT_FPU
0618 
0619 #  endif
0620 
0621 #else // All other platforms.
0622 #  define BOOST_FPU_EXCEPTION_GUARD
0623 #  define BOOST_MATH_INSTRUMENT_FPU
0624 #endif
0625 
0626 #ifdef BOOST_MATH_INSTRUMENT
0627 
0628 #  include <iostream>
0629 #  include <iomanip>
0630 #  include <typeinfo>
0631 
0632 #  define BOOST_MATH_INSTRUMENT_CODE(x) \
0633       std::cout << std::setprecision(35) << __FILE__ << ":" << __LINE__ << " " << x << std::endl;
0634 #  define BOOST_MATH_INSTRUMENT_VARIABLE(name) BOOST_MATH_INSTRUMENT_CODE(#name << " = " << name)
0635 
0636 #else
0637 
0638 #  define BOOST_MATH_INSTRUMENT_CODE(x)
0639 #  define BOOST_MATH_INSTRUMENT_VARIABLE(name)
0640 
0641 #endif
0642 
0643 //
0644 // Thread local storage:
0645 //
0646 #ifndef BOOST_MATH_DISABLE_THREADS
0647 #  define BOOST_MATH_THREAD_LOCAL thread_local
0648 #else
0649 #  define BOOST_MATH_THREAD_LOCAL 
0650 #endif
0651 
0652 //
0653 // Some mingw flavours have issues with thread_local and types with non-trivial destructors
0654 // See https://sourceforge.net/p/mingw-w64/bugs/527/
0655 //
0656 #if (defined(__MINGW32__) && (__GNUC__ < 9) && !defined(__clang__))
0657 #  define BOOST_MATH_NO_THREAD_LOCAL_WITH_NON_TRIVIAL_TYPES
0658 #endif
0659 
0660 
0661 //
0662 // Can we have constexpr tables?
0663 //
0664 #if (!defined(BOOST_MATH_NO_CXX14_CONSTEXPR)) || (defined(_MSC_VER) && _MSC_VER >= 1910)
0665 #define BOOST_MATH_HAVE_CONSTEXPR_TABLES
0666 #define BOOST_MATH_CONSTEXPR_TABLE_FUNCTION constexpr
0667 #else
0668 #define BOOST_MATH_CONSTEXPR_TABLE_FUNCTION
0669 #endif
0670 
0671 //
0672 // CUDA support:
0673 //
0674 
0675 #ifdef __CUDACC__
0676 
0677 // We have to get our include order correct otherwise you get compilation failures
0678 #include <cuda.h>
0679 #include <cuda_runtime.h>
0680 #include <cuda/std/type_traits>
0681 #include <cuda/std/utility>
0682 #include <cuda/std/cstdint>
0683 #include <cuda/std/array>
0684 #include <cuda/std/tuple>
0685 #include <cuda/std/complex>
0686 
0687 #  define BOOST_MATH_CUDA_ENABLED __host__ __device__
0688 #  define BOOST_MATH_HAS_GPU_SUPPORT
0689 
0690 #  ifndef BOOST_MATH_ENABLE_CUDA
0691 #    define BOOST_MATH_ENABLE_CUDA
0692 #  endif
0693 
0694 // Device code can not handle exceptions
0695 #  ifndef BOOST_MATH_NO_EXCEPTIONS
0696 #    define BOOST_MATH_NO_EXCEPTIONS
0697 #  endif
0698 
0699 // We want to use force inline from CUDA instead of the host compiler
0700 #  undef BOOST_MATH_FORCEINLINE
0701 #  define BOOST_MATH_FORCEINLINE __forceinline__
0702 
0703 #elif defined(SYCL_LANGUAGE_VERSION)
0704 
0705 #  define BOOST_MATH_SYCL_ENABLED SYCL_EXTERNAL
0706 #  define BOOST_MATH_HAS_GPU_SUPPORT
0707 
0708 #  ifndef BOOST_MATH_ENABLE_SYCL
0709 #    define BOOST_MATH_ENABLE_SYCL
0710 #  endif
0711 
0712 #  ifndef BOOST_MATH_NO_EXCEPTIONS
0713 #    define BOOST_MATH_NO_EXCEPTIONS
0714 #  endif
0715 
0716 // spir64 does not support long double
0717 #  define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
0718 #  define BOOST_MATH_NO_REAL_CONCEPT_TESTS
0719 
0720 #  undef BOOST_MATH_FORCEINLINE
0721 #  define BOOST_MATH_FORCEINLINE inline
0722 
0723 #endif
0724 
0725 #ifndef BOOST_MATH_CUDA_ENABLED
0726 #  define BOOST_MATH_CUDA_ENABLED
0727 #endif
0728 
0729 #ifndef BOOST_MATH_SYCL_ENABLED
0730 #  define BOOST_MATH_SYCL_ENABLED
0731 #endif
0732 
0733 // Not all functions that allow CUDA allow SYCL (e.g. Recursion is disallowed by SYCL)
0734 #  define BOOST_MATH_GPU_ENABLED BOOST_MATH_CUDA_ENABLED BOOST_MATH_SYCL_ENABLED
0735 
0736 // Additional functions that need replaced/marked up
0737 #ifdef BOOST_MATH_HAS_GPU_SUPPORT
0738 template <class T>
0739 BOOST_MATH_GPU_ENABLED constexpr void gpu_safe_swap(T& a, T& b) { T t(a); a = b; b = t; }
0740 template <class T>
0741 BOOST_MATH_GPU_ENABLED constexpr T gpu_safe_min(const T& a, const T& b) { return a < b ? a : b; }
0742 template <class T>
0743 BOOST_MATH_GPU_ENABLED constexpr T gpu_safe_max(const T& a, const T& b) { return a > b ? a : b; }
0744 
0745 #define BOOST_MATH_GPU_SAFE_SWAP(a, b) gpu_safe_swap(a, b)
0746 #define BOOST_MATH_GPU_SAFE_MIN(a, b) gpu_safe_min(a, b)
0747 #define BOOST_MATH_GPU_SAFE_MAX(a, b) gpu_safe_max(a, b)
0748 
0749 #else
0750 
0751 #define BOOST_MATH_GPU_SAFE_SWAP(a, b) std::swap(a, b)
0752 #define BOOST_MATH_GPU_SAFE_MIN(a, b) (std::min)(a, b)
0753 #define BOOST_MATH_GPU_SAFE_MAX(a, b) (std::max)(a, b)
0754 
0755 #endif
0756 
0757 // Static variables are not allowed with CUDA or C++20 modules
0758 // See if we can inline them instead
0759 
0760 #if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L
0761 #  define BOOST_MATH_INLINE_CONSTEXPR inline constexpr
0762 #  define BOOST_MATH_STATIC static
0763 #  ifndef BOOST_MATH_HAS_GPU_SUPPORT
0764 #    define BOOST_MATH_STATIC_LOCAL_VARIABLE static
0765 #  else
0766 #    define BOOST_MATH_STATIC_LOCAL_VARIABLE
0767 #  endif
0768 #else
0769 #  ifndef BOOST_MATH_HAS_GPU_SUPPORT
0770 #    define BOOST_MATH_INLINE_CONSTEXPR static constexpr
0771 #    define BOOST_MATH_STATIC static
0772 #    define BOOST_MATH_STATIC_LOCAL_VARIABLE
0773 #  else
0774 #    define BOOST_MATH_INLINE_CONSTEXPR constexpr
0775 #    define BOOST_MATH_STATIC constexpr
0776 #    define BOOST_MATH_STATIC_LOCAL_VARIABLE static
0777 #  endif
0778 #endif
0779 
0780 #define BOOST_MATH_FP_NAN FP_NAN
0781 #define BOOST_MATH_FP_INFINITE FP_INFINITE
0782 #define BOOST_MATH_FP_ZERO FP_ZERO
0783 #define BOOST_MATH_FP_SUBNORMAL FP_SUBNORMAL
0784 #define BOOST_MATH_FP_NORMAL FP_NORMAL
0785 
0786 #else // Special section for CUDA NVRTC to ensure we consume no STL headers
0787 
0788 #ifndef BOOST_MATH_STANDALONE
0789 #  define BOOST_MATH_STANDALONE
0790 #endif
0791 
0792 #define BOOST_MATH_HAS_NVRTC
0793 #define BOOST_MATH_ENABLE_CUDA
0794 #define BOOST_MATH_HAS_GPU_SUPPORT
0795 
0796 #define BOOST_MATH_GPU_ENABLED __host__ __device__
0797 #define BOOST_MATH_CUDA_ENABLED __host__ __device__
0798 
0799 #define BOOST_MATH_STATIC static
0800 #define BOOST_MATH_STATIC_LOCAL_VARIABLE
0801 
0802 #define BOOST_MATH_NOEXCEPT(T) noexcept(boost::math::is_floating_point_v<T>)
0803 #define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T) 
0804 #define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) 
0805 #define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T) 
0806 #define BOOST_MATH_BIG_CONSTANT(T, N, V) static_cast<T>(V)
0807 #define BOOST_MATH_FORCEINLINE __forceinline__
0808 #define BOOST_MATH_STD_USING  
0809 #define BOOST_MATH_IF_CONSTEXPR if
0810 #define BOOST_MATH_IS_FLOAT(T) (boost::math::is_floating_point<T>::value)
0811 #define BOOST_MATH_CONSTEXPR_TABLE_FUNCTION constexpr
0812 #define BOOST_MATH_NO_EXCEPTIONS
0813 #define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION 
0814 
0815 // This should be defined to nothing but since it is not specifically a math macro
0816 // we need to undef before proceeding
0817 #ifdef BOOST_FPU_EXCEPTION_GUARD
0818 #  undef BOOST_FPU_EXCEPTION_GUARD
0819 #endif
0820 
0821 #define BOOST_FPU_EXCEPTION_GUARD
0822 
0823 template <class T>
0824 BOOST_MATH_GPU_ENABLED constexpr void gpu_safe_swap(T& a, T& b) { T t(a); a = b; b = t; }
0825 
0826 #define BOOST_MATH_GPU_SAFE_SWAP(a, b) gpu_safe_swap(a, b)
0827 #define BOOST_MATH_GPU_SAFE_MIN(a, b) (::min)(a, b)
0828 #define BOOST_MATH_GPU_SAFE_MAX(a, b) (::max)(a, b)
0829 
0830 #define BOOST_MATH_FP_NAN 0
0831 #define BOOST_MATH_FP_INFINITE 1
0832 #define BOOST_MATH_FP_ZERO 2
0833 #define BOOST_MATH_FP_SUBNORMAL 3
0834 #define BOOST_MATH_FP_NORMAL 4
0835 
0836 #define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF
0837 #define BOOST_MATH_INT_TABLE_TYPE(RT, IT) IT
0838 
0839 #if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L
0840 #  define BOOST_MATH_INLINE_CONSTEXPR inline constexpr
0841 #else
0842 #  define BOOST_MATH_INLINE_CONSTEXPR constexpr
0843 #endif
0844 
0845 #define BOOST_MATH_INSTRUMENT_VARIABLE(x)
0846 #define BOOST_MATH_INSTRUMENT_CODE(x) 
0847 
0848 #endif // NVRTC
0849 
0850 #endif // BOOST_MATH_TOOLS_CONFIG_HPP
0851 
0852 
0853 
0854