New upstream version 8.1.0

This commit is contained in:
geos_one
2025-08-10 01:34:16 +02:00
commit c891bb7105
4398 changed files with 838833 additions and 0 deletions

View File

@@ -0,0 +1,450 @@
// Copyright (c) 2006-7 John Maddock
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_TOOLS_CONFIG_HPP
#define BOOST_MATH_TOOLS_CONFIG_HPP
#ifdef _MSC_VER
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/predef.h>
#include <boost/cstdint.hpp> // for boost::uintmax_t
#include <boost/detail/workaround.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <algorithm> // for min and max
#include <boost/config/no_tr1/cmath.hpp>
#include <climits>
#include <cfloat>
#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
# include <math.h>
#endif
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# include <limits>
#endif
#include <boost/math/tools/user.hpp>
#if (defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__NetBSD__) \
|| (defined(__hppa) && !defined(__OpenBSD__)) || (defined(__NO_LONG_DOUBLE_MATH) && (DBL_MANT_DIG != LDBL_MANT_DIG))) \
&& !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
//
// Borland post 5.8.2 uses Dinkumware's std C lib which
// doesn't have true long double precision. Earlier
// versions are problematic too:
//
# define BOOST_MATH_NO_REAL_CONCEPT_TESTS
# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
# define BOOST_MATH_CONTROL_FP _control87(MCW_EM,MCW_EM)
# include <float.h>
#endif
#ifdef __IBMCPP__
//
// For reasons I don't unserstand, the tests with IMB's compiler all
// pass at long double precision, but fail with real_concept, those tests
// are disabled for now. (JM 2012).
# define BOOST_MATH_NO_REAL_CONCEPT_TESTS
#endif
#ifdef sun
// Any use of __float128 in program startup code causes a segfault (tested JM 2015, Solaris 11).
# define BOOST_MATH_DISABLE_FLOAT128
#endif
#ifdef __HAIKU__
//
// Not sure what's up with the math detection on Haiku, but linking fails with
// float128 code enabled, and we don't have an implementation of __expl, so
// disabling long double functions for now as well.
# define BOOST_MATH_DISABLE_FLOAT128
# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#endif
#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
//
// Darwin's rather strange "double double" is rather hard to
// support, it should be possible given enough effort though...
//
# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#endif
#if defined(unix) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER <= 1000) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
//
// Intel compiler prior to version 10 has sporadic problems
// calling the long double overloads of the std lib math functions:
// calling ::powl is OK, but std::pow(long double, long double)
// may segfault depending upon the value of the arguments passed
// and the specific Linux distribution.
//
// We'll be conservative and disable long double support for this compiler.
//
// Comment out this #define and try building the tests to determine whether
// your Intel compiler version has this issue or not.
//
# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#endif
#if defined(unix) && defined(__INTEL_COMPILER)
//
// Intel compiler has sporadic issues compiling std::fpclassify depending on
// the exact OS version used. Use our own code for this as we know it works
// well on Intel processors:
//
#define BOOST_MATH_DISABLE_STD_FPCLASSIFY
#endif
#if defined(BOOST_MSVC) && !defined(_WIN32_WCE)
// Better safe than sorry, our tests don't support hardware exceptions:
# define BOOST_MATH_CONTROL_FP _control87(MCW_EM,MCW_EM)
#endif
#ifdef __IBMCPP__
# define BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS
#endif
#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901))
# define BOOST_MATH_USE_C99
#endif
#if (defined(__hpux) && !defined(__hppa))
# define BOOST_MATH_USE_C99
#endif
#if defined(__GNUC__) && defined(_GLIBCXX_USE_C99)
# define BOOST_MATH_USE_C99
#endif
#if defined(_LIBCPP_VERSION) && !defined(_MSC_VER)
# define BOOST_MATH_USE_C99
#endif
#if defined(__CYGWIN__) || defined(__HP_aCC) || defined(BOOST_INTEL) \
|| defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \
|| (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99))\
|| defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
# define BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY
#endif
#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
# include "boost/type.hpp"
# include "boost/non_type.hpp"
# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0
# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>*
# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0
# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>*
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \
, BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \
, BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \
, BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \
, BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
#else
// no workaround needed: expand to nothing
# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
#endif // __SUNPRO_CC
#if (defined(__SUNPRO_CC) || defined(__hppa) || defined(__GNUC__)) && !defined(BOOST_MATH_SMALL_CONSTANT)
// Sun's compiler emits a hard error if a constant underflows,
// as does aCC on PA-RISC, while gcc issues a large number of warnings:
# define BOOST_MATH_SMALL_CONSTANT(x) 0.0
#else
# define BOOST_MATH_SMALL_CONSTANT(x) x
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
//
// Define if constants too large for a float cause "bad"
// values to be stored in the data, rather than infinity
// or a suitably large value.
//
# define BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
#endif
//
// Tune performance options for specific compilers:
//
#ifdef BOOST_MSVC
# define BOOST_MATH_POLY_METHOD 2
# define BOOST_MATH_RATIONAL_METHOD 1
#elif defined(BOOST_INTEL)
# define BOOST_MATH_POLY_METHOD 2
# define BOOST_MATH_RATIONAL_METHOD 1
#elif defined(__GNUC__)
#if __GNUC__ < 4
# define BOOST_MATH_POLY_METHOD 3
# define BOOST_MATH_RATIONAL_METHOD 3
# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT
# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L
#else
# define BOOST_MATH_POLY_METHOD 3
# define BOOST_MATH_RATIONAL_METHOD 1
#endif
#endif
#if defined(BOOST_NO_LONG_LONG) && !defined(BOOST_MATH_INT_TABLE_TYPE)
# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT
# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L
#endif
//
// constexpr support, early GCC implementations can't cope so disable
// constexpr for them:
//
#if !defined(__clang) && defined(__GNUC__)
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 490
# define BOOST_MATH_DISABLE_CONSTEXPR
#endif
#endif
#ifdef BOOST_MATH_DISABLE_CONSTEXPR
# define BOOST_MATH_CONSTEXPR
#else
# define BOOST_MATH_CONSTEXPR BOOST_CONSTEXPR
#endif
//
// noexcept support:
//
#ifndef BOOST_NO_CXX11_NOEXCEPT
#ifndef BOOST_NO_CXX11_HDR_TYPE_TRAITS
#include <type_traits>
# define BOOST_MATH_NOEXCEPT(T) noexcept(std::is_floating_point<T>::value)
# define BOOST_MATH_IS_FLOAT(T) (std::is_floating_point<T>::value)
#else
#include <boost/type_traits/is_floating_point.hpp>
# define BOOST_MATH_NOEXCEPT(T) noexcept(boost::is_floating_point<T>::value)
# define BOOST_MATH_IS_FLOAT(T) (boost::is_floating_point<T>::value)
#endif
#else
# define BOOST_MATH_NOEXCEPT(T)
# define BOOST_MATH_IS_FLOAT(T) false
#endif
//
// The maximum order of polynomial that will be evaluated
// via an unrolled specialisation:
//
#ifndef BOOST_MATH_MAX_POLY_ORDER
# define BOOST_MATH_MAX_POLY_ORDER 20
#endif
//
// Set the method used to evaluate polynomials and rationals:
//
#ifndef BOOST_MATH_POLY_METHOD
# define BOOST_MATH_POLY_METHOD 2
#endif
#ifndef BOOST_MATH_RATIONAL_METHOD
# define BOOST_MATH_RATIONAL_METHOD 1
#endif
//
// decide whether to store constants as integers or reals:
//
#ifndef BOOST_MATH_INT_TABLE_TYPE
# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) IT
#endif
#ifndef BOOST_MATH_INT_VALUE_SUFFIX
# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF
#endif
//
// And then the actual configuration:
//
#if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__) \
&& !defined(BOOST_MATH_DISABLE_FLOAT128) || defined(BOOST_MATH_USE_FLOAT128)
//
// Only enable this when the compiler really is GCC as clang and probably
// intel too don't support __float128 yet :-(
//
#ifndef BOOST_MATH_USE_FLOAT128
# define BOOST_MATH_USE_FLOAT128
#endif
# if defined(BOOST_INTEL) && defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION >= 1310) && defined(__GNUC__)
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
# define BOOST_MATH_FLOAT128_TYPE __float128
# endif
# elif defined(__GNUC__)
# define BOOST_MATH_FLOAT128_TYPE __float128
# endif
# ifndef BOOST_MATH_FLOAT128_TYPE
# define BOOST_MATH_FLOAT128_TYPE _Quad
# endif
#endif
//
// Check for WinCE with no iostream support:
//
#if defined(_WIN32_WCE) && !defined(__SGI_STL_PORT)
# define BOOST_MATH_NO_LEXICAL_CAST
#endif
//
// Helper macro for controlling the FP behaviour:
//
#ifndef BOOST_MATH_CONTROL_FP
# define BOOST_MATH_CONTROL_FP
#endif
//
// Helper macro for using statements:
//
#define BOOST_MATH_STD_USING_CORE \
using std::abs;\
using std::acos;\
using std::cos;\
using std::fmod;\
using std::modf;\
using std::tan;\
using std::asin;\
using std::cosh;\
using std::frexp;\
using std::pow;\
using std::tanh;\
using std::atan;\
using std::exp;\
using std::ldexp;\
using std::sin;\
using std::atan2;\
using std::fabs;\
using std::log;\
using std::sinh;\
using std::ceil;\
using std::floor;\
using std::log10;\
using std::sqrt;
#define BOOST_MATH_STD_USING BOOST_MATH_STD_USING_CORE
namespace boost{ namespace math{
namespace tools
{
template <class T>
inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c) BOOST_MATH_NOEXCEPT(T)
{
return (std::max)((std::max)(a, b), c);
}
template <class T>
inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c, T d) BOOST_MATH_NOEXCEPT(T)
{
return (std::max)((std::max)(a, b), (std::max)(c, d));
}
} // namespace tools
template <class T>
void suppress_unused_variable_warning(const T&) BOOST_MATH_NOEXCEPT(T)
{
}
namespace detail{
template <class T>
struct is_integer_for_rounding
{
static const bool value = boost::is_integral<T>::value
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|| (std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer)
#endif
;
};
}
}} // namespace boost namespace math
#ifdef __GLIBC_PREREQ
# if __GLIBC_PREREQ(2,14)
# define BOOST_MATH_HAVE_FIXED_GLIBC
# endif
#endif
#if ((defined(__linux__) && !defined(__UCLIBC__) && !defined(BOOST_MATH_HAVE_FIXED_GLIBC)) || defined(__QNX__) || defined(__IBMCPP__)) && !defined(BOOST_NO_FENV_H)
//
// This code was introduced in response to this glibc bug: http://sourceware.org/bugzilla/show_bug.cgi?id=2445
// Basically powl and expl can return garbage when the result is small and certain exception flags are set
// on entrance to these functions. This appears to have been fixed in Glibc 2.14 (May 2011).
// Much more information in this message thread: https://groups.google.com/forum/#!topic/boost-list/ZT99wtIFlb4
//
#include <boost/detail/fenv.hpp>
# ifdef FE_ALL_EXCEPT
namespace boost{ namespace math{
namespace detail
{
struct fpu_guard
{
fpu_guard()
{
fegetexceptflag(&m_flags, FE_ALL_EXCEPT);
feclearexcept(FE_ALL_EXCEPT);
}
~fpu_guard()
{
fesetexceptflag(&m_flags, FE_ALL_EXCEPT);
}
private:
fexcept_t m_flags;
};
} // namespace detail
}} // namespaces
# define BOOST_FPU_EXCEPTION_GUARD boost::math::detail::fpu_guard local_guard_object;
# define BOOST_MATH_INSTRUMENT_FPU do{ fexcept_t cpu_flags; fegetexceptflag(&cpu_flags, FE_ALL_EXCEPT); BOOST_MATH_INSTRUMENT_VARIABLE(cpu_flags); } while(0);
# else
# define BOOST_FPU_EXCEPTION_GUARD
# define BOOST_MATH_INSTRUMENT_FPU
# endif
#else // All other platforms.
# define BOOST_FPU_EXCEPTION_GUARD
# define BOOST_MATH_INSTRUMENT_FPU
#endif
#ifdef BOOST_MATH_INSTRUMENT
# include <iostream>
# include <iomanip>
# include <typeinfo>
# define BOOST_MATH_INSTRUMENT_CODE(x) \
std::cout << std::setprecision(35) << __FILE__ << ":" << __LINE__ << " " << x << std::endl;
# define BOOST_MATH_INSTRUMENT_VARIABLE(name) BOOST_MATH_INSTRUMENT_CODE(BOOST_STRINGIZE(name) << " = " << name)
#else
# define BOOST_MATH_INSTRUMENT_CODE(x)
# define BOOST_MATH_INSTRUMENT_VARIABLE(name)
#endif
#endif // BOOST_MATH_TOOLS_CONFIG_HPP

View File

@@ -0,0 +1,182 @@
// boost\math\tools\promotion.hpp
// Copyright John Maddock 2006.
// Copyright Paul A. Bristow 2006.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
// Promote arguments functions to allow math functions to have arguments
// provided as integer OR real (floating-point, built-in or UDT)
// (called ArithmeticType in functions that use promotion)
// that help to reduce the risk of creating multiple instantiations.
// Allows creation of an inline wrapper that forwards to a foo(RT, RT) function,
// so you never get to instantiate any mixed foo(RT, IT) functions.
#ifndef BOOST_MATH_PROMOTION_HPP
#define BOOST_MATH_PROMOTION_HPP
#ifdef _MSC_VER
#pragma once
#endif
// Boost type traits:
#include <boost/math/tools/config.hpp>
#include <boost/type_traits/is_floating_point.hpp> // for boost::is_floating_point;
#include <boost/type_traits/is_integral.hpp> // for boost::is_integral
#include <boost/type_traits/is_convertible.hpp> // for boost::is_convertible
#include <boost/type_traits/is_same.hpp>// for boost::is_same
#include <boost/type_traits/remove_cv.hpp>// for boost::remove_cv
// Boost Template meta programming:
#include <boost/mpl/if.hpp> // for boost::mpl::if_c.
#include <boost/mpl/and.hpp> // for boost::mpl::if_c.
#include <boost/mpl/or.hpp> // for boost::mpl::if_c.
#include <boost/mpl/not.hpp> // for boost::mpl::if_c.
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#include <boost/static_assert.hpp>
#endif
namespace boost
{
namespace math
{
namespace tools
{
// If either T1 or T2 is an integer type,
// pretend it was a double (for the purposes of further analysis).
// Then pick the wider of the two floating-point types
// as the actual signature to forward to.
// For example:
// foo(int, short) -> double foo(double, double);
// foo(int, float) -> double foo(double, double);
// Note: NOT float foo(float, float)
// foo(int, double) -> foo(double, double);
// foo(double, float) -> double foo(double, double);
// foo(double, float) -> double foo(double, double);
// foo(any-int-or-float-type, long double) -> foo(long double, long double);
// but ONLY float foo(float, float) is unchanged.
// So the only way to get an entirely float version is to call foo(1.F, 2.F),
// But since most (all?) the math functions convert to double internally,
// probably there would not be the hoped-for gain by using float here.
// This follows the C-compatible conversion rules of pow, etc
// where pow(int, float) is converted to pow(double, double).
template <class T>
struct promote_arg
{ // If T is integral type, then promote to double.
typedef typename mpl::if_<is_integral<T>, double, T>::type type;
};
// These full specialisations reduce mpl::if_ usage and speed up
// compilation:
template <> struct promote_arg<float> { typedef float type; };
template <> struct promote_arg<double>{ typedef double type; };
template <> struct promote_arg<long double> { typedef long double type; };
template <> struct promote_arg<int> { typedef double type; };
template <class T1, class T2>
struct promote_args_2
{ // Promote, if necessary, & pick the wider of the two floating-point types.
// for both parameter types, if integral promote to double.
typedef typename promote_arg<T1>::type T1P; // T1 perhaps promoted.
typedef typename promote_arg<T2>::type T2P; // T2 perhaps promoted.
typedef typename mpl::if_<
typename mpl::and_<is_floating_point<T1P>, is_floating_point<T2P> >::type, // both T1P and T2P are floating-point?
#ifdef BOOST_MATH_USE_FLOAT128
typename mpl::if_< typename mpl::or_<is_same<__float128, T1P>, is_same<__float128, T2P> >::type, // either long double?
__float128,
#endif
typename mpl::if_< typename mpl::or_<is_same<long double, T1P>, is_same<long double, T2P> >::type, // either long double?
long double, // then result type is long double.
typename mpl::if_< typename mpl::or_<is_same<double, T1P>, is_same<double, T2P> >::type, // either double?
double, // result type is double.
float // else result type is float.
>::type
#ifdef BOOST_MATH_USE_FLOAT128
>::type
#endif
>::type,
// else one or the other is a user-defined type:
typename mpl::if_< typename mpl::and_<mpl::not_<is_floating_point<T2P> >, ::boost::is_convertible<T1P, T2P> >, T2P, T1P>::type>::type type;
}; // promote_arg2
// These full specialisations reduce mpl::if_ usage and speed up
// compilation:
template <> struct promote_args_2<float, float> { typedef float type; };
template <> struct promote_args_2<double, double>{ typedef double type; };
template <> struct promote_args_2<long double, long double> { typedef long double type; };
template <> struct promote_args_2<int, int> { typedef double type; };
template <> struct promote_args_2<int, float> { typedef double type; };
template <> struct promote_args_2<float, int> { typedef double type; };
template <> struct promote_args_2<int, double> { typedef double type; };
template <> struct promote_args_2<double, int> { typedef double type; };
template <> struct promote_args_2<int, long double> { typedef long double type; };
template <> struct promote_args_2<long double, int> { typedef long double type; };
template <> struct promote_args_2<float, double> { typedef double type; };
template <> struct promote_args_2<double, float> { typedef double type; };
template <> struct promote_args_2<float, long double> { typedef long double type; };
template <> struct promote_args_2<long double, float> { typedef long double type; };
template <> struct promote_args_2<double, long double> { typedef long double type; };
template <> struct promote_args_2<long double, double> { typedef long double type; };
template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float>
struct promote_args
{
typedef typename promote_args_2<
typename remove_cv<T1>::type,
typename promote_args_2<
typename remove_cv<T2>::type,
typename promote_args_2<
typename remove_cv<T3>::type,
typename promote_args_2<
typename remove_cv<T4>::type,
typename promote_args_2<
typename remove_cv<T5>::type, typename remove_cv<T6>::type
>::type
>::type
>::type
>::type
>::type type;
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
//
// Guard against use of long double if it's not supported:
//
BOOST_STATIC_ASSERT_MSG((0 == ::boost::is_same<type, long double>::value), "Sorry, but this platform does not have sufficient long double support for the special functions to be reliably implemented.");
#endif
};
//
// This struct is the same as above, but has no static assert on long double usage,
// it should be used only on functions that can be implemented for long double
// even when std lib support is missing or broken for that type.
//
template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float>
struct promote_args_permissive
{
typedef typename promote_args_2<
typename remove_cv<T1>::type,
typename promote_args_2<
typename remove_cv<T2>::type,
typename promote_args_2<
typename remove_cv<T3>::type,
typename promote_args_2<
typename remove_cv<T4>::type,
typename promote_args_2<
typename remove_cv<T5>::type, typename remove_cv<T6>::type
>::type
>::type
>::type
>::type
>::type type;
};
} // namespace tools
} // namespace math
} // namespace boost
#endif // BOOST_MATH_PROMOTION_HPP

View File

@@ -0,0 +1,31 @@
// Copyright John Maddock 2006.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_TOOLS_REAL_CAST_HPP
#define BOOST_MATH_TOOLS_REAL_CAST_HPP
#include <boost/math/tools/config.hpp>
#ifdef _MSC_VER
#pragma once
#endif
namespace boost{ namespace math
{
namespace tools
{
template <class To, class T>
inline BOOST_MATH_CONSTEXPR To real_cast(T t) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(T) && BOOST_MATH_IS_FLOAT(To))
{
return static_cast<To>(t);
}
} // namespace tools
} // namespace math
} // namespace boost
#endif // BOOST_MATH_TOOLS_REAL_CAST_HPP

View File

@@ -0,0 +1,105 @@
// Copyright John Maddock 2007.
// Copyright Paul A. Bristow 2007.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_TOOLS_USER_HPP
#define BOOST_MATH_TOOLS_USER_HPP
#ifdef _MSC_VER
#pragma once
#endif
// This file can be modified by the user to change the default policies.
// See "Changing the Policy Defaults" in documentation.
// define this if the platform has no long double functions,
// or if the long double versions have only double precision:
//
// #define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
//
// Performance tuning options:
//
// #define BOOST_MATH_POLY_METHOD 3
// #define BOOST_MATH_RATIONAL_METHOD 3
//
// The maximum order of polynomial that will be evaluated
// via an unrolled specialisation:
//
// #define BOOST_MATH_MAX_POLY_ORDER 17
//
// decide whether to store constants as integers or reals:
//
// #define BOOST_MATH_INT_TABLE_TYPE(RT, IT) IT
//
// Default policies follow:
//
// Domain errors:
//
// #define BOOST_MATH_DOMAIN_ERROR_POLICY throw_on_error
//
// Pole errors:
//
// #define BOOST_MATH_POLE_ERROR_POLICY throw_on_error
//
// Overflow Errors:
//
// #define BOOST_MATH_OVERFLOW_ERROR_POLICY throw_on_error
//
// Internal Evaluation Errors:
//
// #define BOOST_MATH_EVALUATION_ERROR_POLICY throw_on_error
//
// Underfow:
//
// #define BOOST_MATH_UNDERFLOW_ERROR_POLICY ignore_error
//
// Denorms:
//
// #define BOOST_MATH_DENORM_ERROR_POLICY ignore_error
//
// Max digits to use for internal calculations:
//
// #define BOOST_MATH_DIGITS10_POLICY 0
//
// Promote floats to doubles internally?
//
// #define BOOST_MATH_PROMOTE_FLOAT_POLICY true
//
// Promote doubles to long double internally:
//
// #define BOOST_MATH_PROMOTE_DOUBLE_POLICY true
//
// What do discrete quantiles return?
//
// #define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_outwards
//
// If a function is mathematically undefined
// (for example the Cauchy distribution has no mean),
// then do we stop the code from compiling?
//
// #define BOOST_MATH_ASSERT_UNDEFINED_POLICY true
//
// Maximum series iterstions permitted:
//
// #define BOOST_MATH_MAX_SERIES_ITERATION_POLICY 1000000
//
// Maximum root finding steps permitted:
//
// define BOOST_MATH_MAX_ROOT_ITERATION_POLICY 200
//
// Enable use of __float128 in numeric constants:
//
// #define BOOST_MATH_USE_FLOAT128
//
// Disable use of __float128 in numeric_constants even if the compiler looks to support it:
//
// #define BOOST_MATH_DISABLE_FLOAT128
#endif // BOOST_MATH_TOOLS_USER_HPP