diff options
Diffstat (limited to '3rdParty/Boost/src/boost/math/special_functions')
5 files changed, 2628 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp b/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp new file mode 100644 index 0000000..50c034d --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp @@ -0,0 +1,570 @@ +// fp_traits.hpp + +#ifndef BOOST_MATH_FP_TRAITS_HPP +#define BOOST_MATH_FP_TRAITS_HPP + +// Copyright (c) 2006 Johan Rade + +// Distributed under 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) + +/* +To support old compilers, care has been taken to avoid partial template +specialization and meta function forwarding. +With these techniques, the code could be simplified. +*/ + +#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT +// The VAX floating point formats are used (for float and double) +# define BOOST_FPCLASSIFY_VAX_FORMAT +#endif + +#include <cstring> + +#include <boost/assert.hpp> +#include <boost/cstdint.hpp> +#include <boost/detail/endian.hpp> +#include <boost/static_assert.hpp> +#include <boost/type_traits/is_floating_point.hpp> + +#ifdef BOOST_NO_STDC_NAMESPACE + namespace std{ using ::memcpy; } +#endif + +#ifndef FP_NORMAL + +#define FP_ZERO 0 +#define FP_NORMAL 1 +#define FP_INFINITE 2 +#define FP_NAN 3 +#define FP_SUBNORMAL 4 + +#else + +#define BOOST_HAS_FPCLASSIFY + +#ifndef fpclassify +# if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) \ + && defined(_GLIBCXX_USE_C99_MATH) \ + && !(defined(_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) \ + && (_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC != 0)) +# ifdef _STLP_VENDOR_CSTD +# if _STLPORT_VERSION >= 0x520 +# define BOOST_FPCLASSIFY_PREFIX ::__std_alias:: +# else +# define BOOST_FPCLASSIFY_PREFIX ::_STLP_VENDOR_CSTD:: +# endif +# else +# define BOOST_FPCLASSIFY_PREFIX ::std:: +# endif +# else +# undef BOOST_HAS_FPCLASSIFY +# define BOOST_FPCLASSIFY_PREFIX +# endif +#elif (defined(__HP_aCC) && !defined(__hppa)) +// aCC 6 appears to do "#define fpclassify fpclassify" which messes us up a bit! +# define BOOST_FPCLASSIFY_PREFIX :: +#else +# define BOOST_FPCLASSIFY_PREFIX +#endif + +#ifdef __MINGW32__ +# undef BOOST_HAS_FPCLASSIFY +#endif + +#endif + + +//------------------------------------------------------------------------------ + +namespace boost { +namespace math { +namespace detail { + +//------------------------------------------------------------------------------ + +/* +The following classes are used to tag the different methods that are used +for floating point classification +*/ + +struct native_tag {}; +template <bool has_limits> +struct generic_tag {}; +struct ieee_tag {}; +struct ieee_copy_all_bits_tag : public ieee_tag {}; +struct ieee_copy_leading_bits_tag : public ieee_tag {}; + +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +// +// These helper functions are used only when numeric_limits<> +// members are not compile time constants: +// +inline bool is_generic_tag_false(const generic_tag<false>*) +{ + return true; +} +inline bool is_generic_tag_false(const void*) +{ + return false; +} +#endif + +//------------------------------------------------------------------------------ + +/* +Most processors support three different floating point precisions: +single precision (32 bits), double precision (64 bits) +and extended double precision (80 - 128 bits, depending on the processor) + +Note that the C++ type long double can be implemented +both as double precision and extended double precision. +*/ + +struct unknown_precision{}; +struct single_precision {}; +struct double_precision {}; +struct extended_double_precision {}; + +// native_tag version -------------------------------------------------------------- + +template<class T> struct fp_traits_native +{ + typedef native_tag method; +}; + +// generic_tag version ------------------------------------------------------------- + +template<class T, class U> struct fp_traits_non_native +{ +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + typedef generic_tag<std::numeric_limits<T>::is_specialized> method; +#else + typedef generic_tag<false> method; +#endif +}; + +// ieee_tag versions --------------------------------------------------------------- + +/* +These specializations of fp_traits_non_native contain information needed +to "parse" the binary representation of a floating point number. + +Typedef members: + + bits -- the target type when copying the leading bytes of a floating + point number. It is a typedef for uint32_t or uint64_t. + + method -- tells us whether all bytes are copied or not. + It is a typedef for ieee_copy_all_bits_tag or ieee_copy_leading_bits_tag. + +Static data members: + + sign, exponent, flag, significand -- bit masks that give the meaning of the + bits in the leading bytes. + +Static function members: + + get_bits(), set_bits() -- provide access to the leading bytes. + +*/ + +// ieee_tag version, float (32 bits) ----------------------------------------------- + +#ifndef BOOST_FPCLASSIFY_VAX_FORMAT + +template<> struct fp_traits_non_native<float, single_precision> +{ + typedef ieee_copy_all_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7f800000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x007fffff); + + typedef uint32_t bits; + static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); } + static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); } +}; + +// ieee_tag version, double (64 bits) ---------------------------------------------- + +#if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) \ + || defined(__BORLANDC__) || defined(__CODEGEAR__) + +template<> struct fp_traits_non_native<double, double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff); + + typedef uint32_t bits; + + static void get_bits(double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 4); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + +//.............................................................................. + +#else + +template<> struct fp_traits_non_native<double, double_precision> +{ + typedef ieee_copy_all_bits_tag method; + + static const uint64_t sign = ((uint64_t)0x80000000u) << 32; + static const uint64_t exponent = ((uint64_t)0x7ff00000) << 32; + static const uint64_t flag = 0; + static const uint64_t significand + = (((uint64_t)0x000fffff) << 32) + ((uint64_t)0xffffffffu); + + typedef uint64_t bits; + static void get_bits(double x, uint64_t& a) { std::memcpy(&a, &x, 8); } + static void set_bits(double& x, uint64_t a) { std::memcpy(&x, &a, 8); } +}; + +#endif + +#endif // #ifndef BOOST_FPCLASSIFY_VAX_FORMAT + +// long double (64 bits) ------------------------------------------------------- + +#if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)\ + || defined(__BORLANDC__) || defined(__CODEGEAR__) + +template<> struct fp_traits_non_native<long double, double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 4); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + +//.............................................................................. + +#else + +template<> struct fp_traits_non_native<long double, double_precision> +{ + typedef ieee_copy_all_bits_tag method; + + static const uint64_t sign = (uint64_t)0x80000000u << 32; + static const uint64_t exponent = (uint64_t)0x7ff00000 << 32; + static const uint64_t flag = 0; + static const uint64_t significand + = ((uint64_t)0x000fffff << 32) + (uint64_t)0xffffffffu; + + typedef uint64_t bits; + static void get_bits(long double x, uint64_t& a) { std::memcpy(&a, &x, 8); } + static void set_bits(long double& x, uint64_t a) { std::memcpy(&x, &a, 8); } +}; + +#endif + + +// long double (>64 bits), x86 and x64 ----------------------------------------- + +#if defined(__i386) || defined(__i386__) || defined(_M_IX86) \ + || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) \ + || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) + +// Intel extended double precision format (80 bits) + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x00007fff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + 6, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + 6, &a, 4); + } +}; + + +// long double (>64 bits), Itanium --------------------------------------------- + +#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) + +// The floating point format is unknown at compile time +// No template specialization is provided. +// The generic_tag definition is used. + +// The Itanium supports both +// the Intel extended double precision format (80 bits) and +// the IEEE extended double precision format with 15 exponent bits (128 bits). + + +// long double (>64 bits), PowerPC --------------------------------------------- + +#elif defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) \ + || defined(__ppc) || defined(__ppc__) || defined(__PPC__) + +// PowerPC extended double precision format (128 bits) + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 12); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + + +// long double (>64 bits), Motorola 68K ---------------------------------------- + +#elif defined(__m68k) || defined(__m68k__) \ + || defined(__mc68000) || defined(__mc68000__) \ + +// Motorola extended double precision format (96 bits) + +// It is the same format as the Intel extended double precision format, +// except that 1) it is big-endian, 2) the 3rd and 4th byte are padding, and +// 3) the flag bit is not set for infinity + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x00007fff); + + // copy 1st, 2nd, 5th and 6th byte. 3rd and 4th byte are padding. + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, &x, 2); + std::memcpy(reinterpret_cast<unsigned char*>(&a) + 2, + reinterpret_cast<const unsigned char*>(&x) + 4, 2); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(&x, &a, 2); + std::memcpy(reinterpret_cast<unsigned char*>(&x) + 4, + reinterpret_cast<const unsigned char*>(&a) + 2, 2); + } +}; + + +// long double (>64 bits), All other processors -------------------------------- + +#else + +// IEEE extended double precision format with 15 exponent bits (128 bits) + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x0000ffff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 12); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + +#endif + +//------------------------------------------------------------------------------ + +// size_to_precision is a type switch for converting a C++ floating point type +// to the corresponding precision type. + +template<int n, bool fp> struct size_to_precision +{ + typedef unknown_precision type; +}; + +template<> struct size_to_precision<4, true> +{ + typedef single_precision type; +}; + +template<> struct size_to_precision<8, true> +{ + typedef double_precision type; +}; + +template<> struct size_to_precision<10, true> +{ + typedef extended_double_precision type; +}; + +template<> struct size_to_precision<12, true> +{ + typedef extended_double_precision type; +}; + +template<> struct size_to_precision<16, true> +{ + typedef extended_double_precision type; +}; + +//------------------------------------------------------------------------------ +// +// Figure out whether to use native classification functions based on +// whether T is a built in floating point type or not: +// +template <class T> +struct select_native +{ + typedef BOOST_DEDUCED_TYPENAME size_to_precision<sizeof(T), ::boost::is_floating_point<T>::value>::type precision; + typedef fp_traits_non_native<T, precision> type; +}; +template<> +struct select_native<float> +{ + typedef fp_traits_native<float> type; +}; +template<> +struct select_native<double> +{ + typedef fp_traits_native<double> type; +}; +template<> +struct select_native<long double> +{ + typedef fp_traits_native<long double> type; +}; + +//------------------------------------------------------------------------------ + +// fp_traits is a type switch that selects the right fp_traits_non_native + +#if (defined(BOOST_MATH_USE_C99) && !(defined(__GNUC__) && (__GNUC__ < 4))) \ + && !defined(__hpux) \ + && !defined(__DECCXX)\ + && !defined(__osf__) \ + && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\ + && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) +# define BOOST_MATH_USE_STD_FPCLASSIFY +#endif + +template<class T> struct fp_traits +{ + typedef BOOST_DEDUCED_TYPENAME size_to_precision<sizeof(T), ::boost::is_floating_point<T>::value>::type precision; +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) + typedef typename select_native<T>::type type; +#else + typedef fp_traits_non_native<T, precision> type; +#endif + typedef fp_traits_non_native<T, precision> sign_change_type; +}; + +//------------------------------------------------------------------------------ + +} // namespace detail +} // namespace math +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp b/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp new file mode 100644 index 0000000..952259a --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp @@ -0,0 +1,80 @@ +// Copyright John Maddock 2008. + +// 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_SPECIAL_ROUND_FWD_HPP +#define BOOST_MATH_SPECIAL_ROUND_FWD_HPP + +#include <boost/config.hpp> + +#ifdef _MSC_VER +#pragma once +#endif + +namespace boost +{ + namespace math + { + + template <class T, class Policy> + T trunc(const T& v, const Policy& pol); + template <class T> + T trunc(const T& v); + template <class T, class Policy> + int itrunc(const T& v, const Policy& pol); + template <class T> + int itrunc(const T& v); + template <class T, class Policy> + long ltrunc(const T& v, const Policy& pol); + template <class T> + long ltrunc(const T& v); +#ifdef BOOST_HAS_LONG_LONG + template <class T, class Policy> + boost::long_long_type lltrunc(const T& v, const Policy& pol); + template <class T> + boost::long_long_type lltrunc(const T& v); +#endif + template <class T, class Policy> + T round(const T& v, const Policy& pol); + template <class T> + T round(const T& v); + template <class T, class Policy> + int iround(const T& v, const Policy& pol); + template <class T> + int iround(const T& v); + template <class T, class Policy> + long lround(const T& v, const Policy& pol); + template <class T> + long lround(const T& v); +#ifdef BOOST_HAS_LONG_LONG + template <class T, class Policy> + boost::long_long_type llround(const T& v, const Policy& pol); + template <class T> + boost::long_long_type llround(const T& v); +#endif + template <class T, class Policy> + T modf(const T& v, T* ipart, const Policy& pol); + template <class T> + T modf(const T& v, T* ipart); + template <class T, class Policy> + T modf(const T& v, int* ipart, const Policy& pol); + template <class T> + T modf(const T& v, int* ipart); + template <class T, class Policy> + T modf(const T& v, long* ipart, const Policy& pol); + template <class T> + T modf(const T& v, long* ipart); +#ifdef BOOST_HAS_LONG_LONG + template <class T, class Policy> + T modf(const T& v, boost::long_long_type* ipart, const Policy& pol); + template <class T> + T modf(const T& v, boost::long_long_type* ipart); +#endif + + } +} +#endif // BOOST_MATH_SPECIAL_ROUND_FWD_HPP + diff --git a/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp new file mode 100644 index 0000000..6f92d18 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp @@ -0,0 +1,537 @@ +// Copyright John Maddock 2005-2008. +// Copyright (c) 2006-2008 Johan Rade +// 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_FPCLASSIFY_HPP +#define BOOST_MATH_FPCLASSIFY_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include <math.h> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/limits.hpp> +#include <boost/math/tools/real_cast.hpp> +#include <boost/type_traits/is_floating_point.hpp> +#include <boost/math/special_functions/math_fwd.hpp> +#include <boost/math/special_functions/detail/fp_traits.hpp> +/*! + \file fpclassify.hpp + \brief Classify floating-point value as normal, subnormal, zero, infinite, or NaN. + \version 1.0 + \author John Maddock + */ + +/* + +1. If the platform is C99 compliant, then the native floating point +classification functions are used. However, note that we must only +define the functions which call std::fpclassify etc if that function +really does exist: otherwise a compiler may reject the code even though +the template is never instantiated. + +2. If the platform is not C99 compliant, and the binary format for +a floating point type (float, double or long double) can be determined +at compile time, then the following algorithm is used: + + If all exponent bits, the flag bit (if there is one), + and all significand bits are 0, then the number is zero. + + If all exponent bits and the flag bit (if there is one) are 0, + and at least one significand bit is 1, then the number is subnormal. + + If all exponent bits are 1 and all significand bits are 0, + then the number is infinity. + + If all exponent bits are 1 and at least one significand bit is 1, + then the number is a not-a-number. + + Otherwise the number is normal. + + This algorithm works for the IEEE 754 representation, + and also for several non IEEE 754 formats. + + Most formats have the structure + sign bit + exponent bits + significand bits. + + A few have the structure + sign bit + exponent bits + flag bit + significand bits. + The flag bit is 0 for zero and subnormal numbers, + and 1 for normal numbers and NaN. + It is 0 (Motorola 68K) or 1 (Intel) for infinity. + + To get the bits, the four or eight most significant bytes are copied + into an uint32_t or uint64_t and bit masks are applied. + This covers all the exponent bits and the flag bit (if there is one), + but not always all the significand bits. + Some of the functions below have two implementations, + depending on whether all the significand bits are copied or not. + +3. If the platform is not C99 compliant, and the binary format for +a floating point type (float, double or long double) can not be determined +at compile time, then comparison with std::numeric_limits values +is used. + +*/ + +#if defined(_MSC_VER) || defined(__BORLANDC__) +#include <float.h> +#endif + +#ifdef BOOST_NO_STDC_NAMESPACE + namespace std{ using ::abs; using ::fabs; } +#endif + +namespace boost{ + +// +// This must not be located in any namespace under boost::math +// otherwise we can get into an infinite loop if isnan is +// a #define for "isnan" ! +// +namespace math_detail{ + +template <class T> +inline bool is_nan_helper(T t, const boost::true_type&) +{ +#ifdef isnan + return isnan(t); +#elif defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) || !defined(BOOST_HAS_FPCLASSIFY) + return false; +#else // BOOST_HAS_FPCLASSIFY + return (BOOST_FPCLASSIFY_PREFIX fpclassify(t) == (int)FP_NAN); +#endif +} + +template <class T> +inline bool is_nan_helper(T, const boost::false_type&) +{ + return false; +} + +} + +namespace math{ + +namespace detail{ + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY +template <class T> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const native_tag&) +{ + return (std::fpclassify)(t); +} +#endif + +template <class T> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<true>&) +{ + BOOST_MATH_INSTRUMENT_VARIABLE(t); + + // whenever possible check for Nan's first: +#if defined(BOOST_HAS_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) + if(::boost::math_detail::is_nan_helper(t, ::boost::is_floating_point<T>())) + return FP_NAN; +#elif defined(isnan) + if(boost::math_detail::is_nan_helper(t, ::boost::is_floating_point<T>())) + return FP_NAN; +#elif defined(_MSC_VER) || defined(__BORLANDC__) + if(::_isnan(boost::math::tools::real_cast<double>(t))) + return FP_NAN; +#endif + // std::fabs broken on a few systems especially for long long!!!! + T at = (t < T(0)) ? -t : t; + + // Use a process of exclusion to figure out + // what kind of type we have, this relies on + // IEEE conforming reals that will treat + // Nan's as unordered. Some compilers + // don't do this once optimisations are + // turned on, hence the check for nan's above. + if(at <= (std::numeric_limits<T>::max)()) + { + if(at >= (std::numeric_limits<T>::min)()) + return FP_NORMAL; + return (at != 0) ? FP_SUBNORMAL : FP_ZERO; + } + else if(at > (std::numeric_limits<T>::max)()) + return FP_INFINITE; + return FP_NAN; +} + +template <class T> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<false>&) +{ +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return fpclassify_imp(t, generic_tag<true>()); +#endif + // + // An unknown type with no numeric_limits support, + // so what are we supposed to do we do here? + // + BOOST_MATH_INSTRUMENT_VARIABLE(t); + + return t == 0 ? FP_ZERO : FP_NORMAL; +} + +template<class T> +int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_all_bits_tag) +{ + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_MATH_INSTRUMENT_VARIABLE(x); + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + BOOST_MATH_INSTRUMENT_VARIABLE(a); + a &= traits::exponent | traits::flag | traits::significand; + BOOST_MATH_INSTRUMENT_VARIABLE((traits::exponent | traits::flag | traits::significand)); + BOOST_MATH_INSTRUMENT_VARIABLE(a); + + if(a <= traits::significand) { + if(a == 0) + return FP_ZERO; + else + return FP_SUBNORMAL; + } + + if(a < traits::exponent) return FP_NORMAL; + + a &= traits::significand; + if(a == 0) return FP_INFINITE; + + return FP_NAN; +} + +template<class T> +int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag) +{ + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_MATH_INSTRUMENT_VARIABLE(x); + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::flag | traits::significand; + + if(a <= traits::significand) { + if(x == 0) + return FP_ZERO; + else + return FP_SUBNORMAL; + } + + if(a < traits::exponent) return FP_NORMAL; + + a &= traits::significand; + traits::set_bits(x,a); + if(x == 0) return FP_INFINITE; + + return FP_NAN; +} + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline int fpclassify_imp<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::fpclassify_imp(t, generic_tag<true>()); +} +#endif + +} // namespace detail + +template <class T> +inline int fpclassify BOOST_NO_MACRO_EXPAND(T t) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename tools::promote_args<T>::type value_type; +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0))) + return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>()); + return detail::fpclassify_imp(static_cast<value_type>(t), method()); +#else + return detail::fpclassify_imp(static_cast<value_type>(t), method()); +#endif +} + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isfinite_impl(T x, native_tag const&) + { + return (std::isfinite)(x); + } +#endif + + template<class T> + inline bool isfinite_impl(T x, generic_tag<true> const&) + { + return x >= -(std::numeric_limits<T>::max)() + && x <= (std::numeric_limits<T>::max)(); + } + + template<class T> + inline bool isfinite_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isfinite_impl(x, generic_tag<true>()); +#endif + (void)x; // warning supression. + return true; + } + + template<class T> + inline bool isfinite_impl(T x, ieee_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits; + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent; + return a != traits::exponent; + } + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isfinite_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isfinite_impl(t, generic_tag<true>()); +} +#endif + +} + +template<class T> +inline bool (isfinite)(T x) +{ //!< \brief return true if floating-point type t is finite. + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args<T>::type value_type; + return detail::isfinite_impl(static_cast<value_type>(x), method()); +} + +//------------------------------------------------------------------------------ + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isnormal_impl(T x, native_tag const&) + { + return (std::isnormal)(x); + } +#endif + + template<class T> + inline bool isnormal_impl(T x, generic_tag<true> const&) + { + if(x < 0) x = -x; + return x >= (std::numeric_limits<T>::min)() + && x <= (std::numeric_limits<T>::max)(); + } + + template<class T> + inline bool isnormal_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isnormal_impl(x, generic_tag<true>()); +#endif + return !(x == 0); + } + + template<class T> + inline bool isnormal_impl(T x, ieee_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits; + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::flag; + return (a != 0) && (a < traits::exponent); + } + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isnormal_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isnormal_impl(t, generic_tag<true>()); +} +#endif + +} + +template<class T> +inline bool (isnormal)(T x) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args<T>::type value_type; + return detail::isnormal_impl(static_cast<value_type>(x), method()); +} + +//------------------------------------------------------------------------------ + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isinf_impl(T x, native_tag const&) + { + return (std::isinf)(x); + } +#endif + + template<class T> + inline bool isinf_impl(T x, generic_tag<true> const&) + { + (void)x; // in case the compiler thinks that x is unused because std::numeric_limits<T>::has_infinity is false + return std::numeric_limits<T>::has_infinity + && ( x == std::numeric_limits<T>::infinity() + || x == -std::numeric_limits<T>::infinity()); + } + + template<class T> + inline bool isinf_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isinf_impl(x, generic_tag<true>()); +#endif + (void)x; // warning supression. + return false; + } + + template<class T> + inline bool isinf_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::significand; + return a == traits::exponent; + } + + template<class T> + inline bool isinf_impl(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::significand; + if(a != traits::exponent) + return false; + + traits::set_bits(x,0); + return x == 0; + } + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isinf_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isinf_impl(t, generic_tag<true>()); +} +#endif + +} // namespace detail + +template<class T> +inline bool (isinf)(T x) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args<T>::type value_type; + return detail::isinf_impl(static_cast<value_type>(x), method()); +} + +//------------------------------------------------------------------------------ + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isnan_impl(T x, native_tag const&) + { + return (std::isnan)(x); + } +#endif + + template<class T> + inline bool isnan_impl(T x, generic_tag<true> const&) + { + return std::numeric_limits<T>::has_infinity + ? !(x <= std::numeric_limits<T>::infinity()) + : x != x; + } + + template<class T> + inline bool isnan_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isnan_impl(x, generic_tag<true>()); +#endif + (void)x; // warning supression + return false; + } + + template<class T> + inline bool isnan_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::significand; + return a > traits::exponent; + } + + template<class T> + inline bool isnan_impl(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + + a &= traits::exponent | traits::significand; + if(a < traits::exponent) + return false; + + a &= traits::significand; + traits::set_bits(x,a); + return x != 0; + } + +} // namespace detail + +template<class T> bool (isnan)(T x) +{ //!< \brief return true if floating-point type t is NaN (Not A Number). + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + return detail::isnan_impl(x, method()); +} + +#ifdef isnan +template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +template <> inline bool isnan BOOST_NO_MACRO_EXPAND<double>(double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +template <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +#endif + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_FPCLASSIFY_HPP + diff --git a/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp b/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp new file mode 100644 index 0000000..6669e3f --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp @@ -0,0 +1,1296 @@ +// math_fwd.hpp + +// TODO revise completely for new distribution classes. + +// Copyright Paul A. Bristow 2006. +// 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) + +// Omnibus list of forward declarations of math special functions. + +// IT = Integer type. +// RT = Real type (built-in floating-point types, float, double, long double) & User Defined Types +// AT = Integer or Real type + +#ifndef BOOST_MATH_SPECIAL_MATH_FWD_HPP +#define BOOST_MATH_SPECIAL_MATH_FWD_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include <boost/math/special_functions/detail/round_fwd.hpp> +#include <boost/math/tools/promotion.hpp> // for argument promotion. +#include <boost/math/policies/policy.hpp> +#include <boost/mpl/comparison.hpp> +#include <boost/config/no_tr1/complex.hpp> + +#define BOOST_NO_MACRO_EXPAND /**/ + +namespace boost +{ + namespace math + { // Math functions (in roughly alphabetic order). + + // Beta functions. + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type + beta(RT1 a, RT2 b); // Beta function (2 arguments). + + template <class RT1, class RT2, class A> + typename tools::promote_args<RT1, RT2, A>::type + beta(RT1 a, RT2 b, A x); // Beta function (3 arguments). + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + beta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Beta function (3 arguments). + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + betac(RT1 a, RT2 b, RT3 x); + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + betac(RT1 a, RT2 b, RT3 x, const Policy& pol); + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta(RT1 a, RT2 b, RT3 x); // Incomplete beta function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac(RT1 a, RT2 b, RT3 x); // Incomplete beta complement function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta complement function. + + template <class T1, class T2, class T3, class T4> + typename tools::promote_args<T1, T2, T3, T4>::type + ibeta_inv(T1 a, T2 b, T3 p, T4* py); + + template <class T1, class T2, class T3, class T4, class Policy> + typename tools::promote_args<T1, T2, T3, T4>::type + ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol); + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inv(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inv(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inva(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inva(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_invb(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_invb(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. + + template <class T1, class T2, class T3, class T4> + typename tools::promote_args<T1, T2, T3, T4>::type + ibetac_inv(T1 a, T2 b, T3 q, T4* py); + + template <class T1, class T2, class T3, class T4, class Policy> + typename tools::promote_args<T1, T2, T3, T4>::type + ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol); + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inv(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inva(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inva(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_invb(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_invb(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_derivative(RT1 a, RT2 b, RT3 x); // derivative of incomplete beta + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy& pol); // derivative of incomplete beta + + // erf & erfc error functions. + template <class RT> // Error function. + typename tools::promote_args<RT>::type erf(RT z); + template <class RT, class Policy> // Error function. + typename tools::promote_args<RT>::type erf(RT z, const Policy&); + + template <class RT>// Error function complement. + typename tools::promote_args<RT>::type erfc(RT z); + template <class RT, class Policy>// Error function complement. + typename tools::promote_args<RT>::type erfc(RT z, const Policy&); + + template <class RT>// Error function inverse. + typename tools::promote_args<RT>::type erf_inv(RT z); + template <class RT, class Policy>// Error function inverse. + typename tools::promote_args<RT>::type erf_inv(RT z, const Policy& pol); + + template <class RT>// Error function complement inverse. + typename tools::promote_args<RT>::type erfc_inv(RT z); + template <class RT, class Policy>// Error function complement inverse. + typename tools::promote_args<RT>::type erfc_inv(RT z, const Policy& pol); + + // Polynomials: + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1); + + template <class T> + typename tools::promote_args<T>::type + legendre_p(int l, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + legendre_p(int l, T x, const Policy& pol); + + template <class T> + typename tools::promote_args<T>::type + legendre_q(unsigned l, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + legendre_q(unsigned l, T x, const Policy& pol); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1); + + template <class T> + typename tools::promote_args<T>::type + legendre_p(int l, int m, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + legendre_p(int l, int m, T x, const Policy& pol); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + laguerre_next(unsigned n, unsigned l, T1 x, T2 Pl, T3 Plm1); + + template <class T> + typename tools::promote_args<T>::type + laguerre(unsigned n, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + laguerre(unsigned n, unsigned m, T x, const Policy& pol); + + template <class T1, class T2> + struct laguerre_result + { + typedef typename mpl::if_< + policies::is_policy<T2>, + typename tools::promote_args<T1>::type, + typename tools::promote_args<T2>::type + >::type type; + }; + + template <class T1, class T2> + typename laguerre_result<T1, T2>::type + laguerre(unsigned n, T1 m, T2 x); + + template <class T> + typename tools::promote_args<T>::type + hermite(unsigned n, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + hermite(unsigned n, T x, const Policy& pol); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + hermite_next(unsigned n, T1 x, T2 Hn, T3 Hnm1); + + template <class T1, class T2> + std::complex<typename tools::promote_args<T1, T2>::type> + spherical_harmonic(unsigned n, int m, T1 theta, T2 phi); + + template <class T1, class T2, class Policy> + std::complex<typename tools::promote_args<T1, T2>::type> + spherical_harmonic(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); + + // Elliptic integrals: + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + ellint_rf(T1 x, T2 y, T3 z); + + template <class T1, class T2, class T3, class Policy> + typename tools::promote_args<T1, T2, T3>::type + ellint_rf(T1 x, T2 y, T3 z, const Policy& pol); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + ellint_rd(T1 x, T2 y, T3 z); + + template <class T1, class T2, class T3, class Policy> + typename tools::promote_args<T1, T2, T3>::type + ellint_rd(T1 x, T2 y, T3 z, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + ellint_rc(T1 x, T2 y); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + ellint_rc(T1 x, T2 y, const Policy& pol); + + template <class T1, class T2, class T3, class T4> + typename tools::promote_args<T1, T2, T3, T4>::type + ellint_rj(T1 x, T2 y, T3 z, T4 p); + + template <class T1, class T2, class T3, class T4, class Policy> + typename tools::promote_args<T1, T2, T3, T4>::type + ellint_rj(T1 x, T2 y, T3 z, T4 p, const Policy& pol); + + template <typename T> + typename tools::promote_args<T>::type ellint_2(T k); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi, const Policy& pol); + + template <typename T> + typename tools::promote_args<T>::type ellint_1(T k); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi, const Policy& pol); + + namespace detail{ + + template <class T, class U, class V> + struct ellint_3_result + { + typedef typename mpl::if_< + policies::is_policy<V>, + typename tools::promote_args<T, U>::type, + typename tools::promote_args<T, U, V>::type + >::type type; + }; + + } // namespace detail + + + template <class T1, class T2, class T3> + typename detail::ellint_3_result<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi); + + template <class T1, class T2, class T3, class Policy> + typename tools::promote_args<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type ellint_3(T1 k, T2 v); + + // Factorial functions. + // Note: not for integral types, at present. + template <class RT> + struct max_factorial; + template <class RT> + RT factorial(unsigned int); + template <class RT, class Policy> + RT factorial(unsigned int, const Policy& pol); + template <class RT> + RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT)); + template <class RT> + RT double_factorial(unsigned i); + template <class RT, class Policy> + RT double_factorial(unsigned i, const Policy& pol); + + template <class RT> + typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n, const Policy& pol); + + template <class RT> + typename tools::promote_args<RT>::type rising_factorial(RT x, int n); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type rising_factorial(RT x, int n, const Policy& pol); + + // Gamma functions. + template <class RT> + typename tools::promote_args<RT>::type tgamma(RT z); + + template <class RT> + typename tools::promote_args<RT>::type tgamma1pm1(RT z); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type tgamma1pm1(RT z, const Policy& pol); + + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type tgamma(RT1 a, RT2 z); + + template <class RT1, class RT2, class Policy> + typename tools::promote_args<RT1, RT2>::type tgamma(RT1 a, RT2 z, const Policy& pol); + + template <class RT> + typename tools::promote_args<RT>::type lgamma(RT z, int* sign); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type lgamma(RT z, int* sign, const Policy& pol); + + template <class RT> + typename tools::promote_args<RT>::type lgamma(RT x); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type lgamma(RT x, const Policy& pol); + + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type tgamma_lower(RT1 a, RT2 z); + + template <class RT1, class RT2, class Policy> + typename tools::promote_args<RT1, RT2>::type tgamma_lower(RT1 a, RT2 z, const Policy&); + + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type gamma_q(RT1 a, RT2 z); + + template <class RT1, class RT2, class Policy> + typename tools::promote_args<RT1, RT2>::type gamma_q(RT1 a, RT2 z, const Policy&); + + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type gamma_p(RT1 a, RT2 z); + + template <class RT1, class RT2, class Policy> + typename tools::promote_args<RT1, RT2>::type gamma_p(RT1 a, RT2 z, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type tgamma_delta_ratio(T1 z, T2 delta); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type tgamma_delta_ratio(T1 z, T2 delta, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type tgamma_ratio(T1 a, T2 b); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type tgamma_ratio(T1 a, T2 b, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_p_derivative(T1 a, T2 x); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_p_derivative(T1 a, T2 x, const Policy&); + + // gamma inverse. + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_p_inv(T1 a, T2 p); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_p_inva(T1 a, T2 p, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_p_inva(T1 a, T2 p); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_p_inv(T1 a, T2 p, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_q_inv(T1 a, T2 q); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_q_inv(T1 a, T2 q, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_q_inva(T1 a, T2 q); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_q_inva(T1 a, T2 q, const Policy&); + + // digamma: + template <class T> + typename tools::promote_args<T>::type digamma(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type digamma(T x, const Policy&); + + // Hypotenuse function sqrt(x ^ 2 + y ^ 2). + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + hypot(T1 x, T2 y); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + hypot(T1 x, T2 y, const Policy&); + + // cbrt - cube root. + template <class RT> + typename tools::promote_args<RT>::type cbrt(RT z); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type cbrt(RT z, const Policy&); + + // log1p is log(x + 1) + template <class T> + typename tools::promote_args<T>::type log1p(T); + + template <class T, class Policy> + typename tools::promote_args<T>::type log1p(T, const Policy&); + + // log1pmx is log(x + 1) - x + template <class T> + typename tools::promote_args<T>::type log1pmx(T); + + template <class T, class Policy> + typename tools::promote_args<T>::type log1pmx(T, const Policy&); + + // Exp (x) minus 1 functions. + template <class T> + typename tools::promote_args<T>::type expm1(T); + + template <class T, class Policy> + typename tools::promote_args<T>::type expm1(T, const Policy&); + + // Power - 1 + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + powm1(const T1 a, const T2 z); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + powm1(const T1 a, const T2 z, const Policy&); + + // sqrt(1+x) - 1 + template <class T> + typename tools::promote_args<T>::type sqrt1pm1(const T& val); + + template <class T, class Policy> + typename tools::promote_args<T>::type sqrt1pm1(const T& val, const Policy&); + + // sinus cardinals: + template <class T> + typename tools::promote_args<T>::type sinc_pi(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type sinc_pi(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type sinhc_pi(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type sinhc_pi(T x, const Policy&); + + // inverse hyperbolics: + template<typename T> + typename tools::promote_args<T>::type asinh(T x); + + template<typename T, class Policy> + typename tools::promote_args<T>::type asinh(T x, const Policy&); + + template<typename T> + typename tools::promote_args<T>::type acosh(T x); + + template<typename T, class Policy> + typename tools::promote_args<T>::type acosh(T x, const Policy&); + + template<typename T> + typename tools::promote_args<T>::type atanh(T x); + + template<typename T, class Policy> + typename tools::promote_args<T>::type atanh(T x, const Policy&); + + namespace detail{ + + typedef mpl::int_<0> bessel_no_int_tag; // No integer optimisation possible. + typedef mpl::int_<1> bessel_maybe_int_tag; // Maybe integer optimisation. + typedef mpl::int_<2> bessel_int_tag; // Definite integer optimistaion. + + template <class T1, class T2, class Policy> + struct bessel_traits + { + typedef typename tools::promote_args< + T1, T2 + >::type result_type; + + typedef typename policies::precision<result_type, Policy>::type precision_type; + + typedef typename mpl::if_< + mpl::or_< + mpl::less_equal<precision_type, mpl::int_<0> >, + mpl::greater<precision_type, mpl::int_<64> > >, + bessel_no_int_tag, + typename mpl::if_< + is_integral<T1>, + bessel_int_tag, + bessel_maybe_int_tag + >::type + >::type optimisation_tag; + }; + } // detail + + // Bessel functions: + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_j(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_j(T1 v, T2 x); + + template <class T, class Policy> + typename detail::bessel_traits<T, T, Policy>::result_type sph_bessel(unsigned v, T x, const Policy& pol); + + template <class T> + typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_bessel(unsigned v, T x); + + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_i(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_i(T1 v, T2 x); + + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_k(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_k(T1 v, T2 x); + + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_neumann(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_neumann(T1 v, T2 x); + + template <class T, class Policy> + typename detail::bessel_traits<T, T, Policy>::result_type sph_neumann(unsigned v, T x, const Policy& pol); + + template <class T> + typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_neumann(unsigned v, T x); + + template <class T1, class T2, class Policy> + std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> cyl_hankel_1(T1 v, T2 x); + + template <class T1, class T2, class Policy> + std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_2(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> cyl_hankel_2(T1 v, T2 x); + + template <class T1, class T2, class Policy> + std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> sph_hankel_1(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> sph_hankel_1(T1 v, T2 x); + + template <class T1, class T2, class Policy> + std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> sph_hankel_2(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> sph_hankel_2(T1 v, T2 x); + + template <class T, class Policy> + typename tools::promote_args<T>::type airy_ai(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type airy_ai(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type airy_bi(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type airy_bi(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type airy_ai_prime(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type airy_ai_prime(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type airy_bi_prime(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type airy_bi_prime(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type sin_pi(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type sin_pi(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type cos_pi(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type cos_pi(T x); + + template <class T> + int fpclassify BOOST_NO_MACRO_EXPAND(T t); + + template <class T> + bool isfinite BOOST_NO_MACRO_EXPAND(T z); + + template <class T> + bool isinf BOOST_NO_MACRO_EXPAND(T t); + + template <class T> + bool isnan BOOST_NO_MACRO_EXPAND(T t); + + template <class T> + bool isnormal BOOST_NO_MACRO_EXPAND(T t); + + template<class T> + int signbit BOOST_NO_MACRO_EXPAND(T x); + + template <class T> + int sign BOOST_NO_MACRO_EXPAND(const T& z); + + template <class T> + T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y); + + template <class T> + T changesign BOOST_NO_MACRO_EXPAND(const T& z); + + // Exponential integrals: + namespace detail{ + + template <class T, class U> + struct expint_result + { + typedef typename mpl::if_< + policies::is_policy<U>, + typename tools::promote_args<T>::type, + typename tools::promote_args<U>::type + >::type type; + }; + + } // namespace detail + + template <class T, class Policy> + typename tools::promote_args<T>::type expint(unsigned n, T z, const Policy&); + + template <class T, class U> + typename detail::expint_result<T, U>::type expint(T const z, U const u); + + template <class T> + typename tools::promote_args<T>::type expint(T z); + + // Zeta: + template <class T, class Policy> + typename tools::promote_args<T>::type zeta(T s, const Policy&); + + // Owen's T function: + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type owens_t(T1 h, T2 a, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type owens_t(T1 h, T2 a); + + // Jacobi Functions: + template <class T, class Policy> + typename tools::promote_args<T>::type jacobi_elliptic(T k, T theta, T* pcn, T* pdn, const Policy&); + + template <class T> + typename tools::promote_args<T>::type jacobi_elliptic(T k, T theta, T* pcn = 0, T* pdn = 0); + + template <class U, class T, class Policy> + typename tools::promote_args<T, U>::type jacobi_sn(U k, T theta, const Policy& pol); + + template <class U, class T> + typename tools::promote_args<T, U>::type jacobi_sn(U k, T theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_cn(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_cn(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_dn(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_dn(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_cd(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_cd(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_dc(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_dc(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_ns(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_ns(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_sd(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_sd(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_ds(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_ds(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_nc(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_nc(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_nd(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_nd(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_sc(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_sc(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_cs(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_cs(T k, U theta); + + + template <class T> + typename tools::promote_args<T>::type zeta(T s); + + // pow: + template <int N, typename T, class Policy> + typename tools::promote_args<T>::type pow(T base, const Policy& policy); + + template <int N, typename T> + typename tools::promote_args<T>::type pow(T base); + + // next: + template <class T, class Policy> + T nextafter(const T&, const T&, const Policy&); + template <class T> + T nextafter(const T&, const T&); + template <class T, class Policy> + T float_next(const T&, const Policy&); + template <class T> + T float_next(const T&); + template <class T, class Policy> + T float_prior(const T&, const Policy&); + template <class T> + T float_prior(const T&); + template <class T, class Policy> + T float_distance(const T&, const T&, const Policy&); + template <class T> + T float_distance(const T&, const T&); + + } // namespace math +} // namespace boost + +#ifdef BOOST_HAS_LONG_LONG +#define BOOST_MATH_DETAIL_LL_FUNC(Policy)\ + \ + template <class T>\ + inline T modf(const T& v, boost::long_long_type* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + \ + template <class T>\ + inline boost::long_long_type lltrunc(const T& v){ using boost::math::lltrunc; return lltrunc(v, Policy()); }\ + \ + template <class T>\ + inline boost::long_long_type llround(const T& v){ using boost::math::llround; return llround(v, Policy()); }\ + +#else +#define BOOST_MATH_DETAIL_LL_FUNC(Policy) +#endif + +#define BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(Policy)\ + \ + BOOST_MATH_DETAIL_LL_FUNC(Policy)\ + \ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type \ + beta(RT1 a, RT2 b) { return ::boost::math::beta(a, b, Policy()); }\ +\ + template <class RT1, class RT2, class A>\ + inline typename boost::math::tools::promote_args<RT1, RT2, A>::type \ + beta(RT1 a, RT2 b, A x){ return ::boost::math::beta(a, b, x, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + betac(RT1 a, RT2 b, RT3 x) { return ::boost::math::betac(a, b, x, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibeta(a, b, x, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibetac(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibetac(a, b, x, Policy()); }\ +\ + template <class T1, class T2, class T3, class T4>\ + inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \ + ibeta_inv(T1 a, T2 b, T3 p, T4* py){ return ::boost::math::ibeta_inv(a, b, p, py, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta_inv(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_inv(a, b, p, Policy()); }\ +\ + template <class T1, class T2, class T3, class T4>\ + inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \ + ibetac_inv(T1 a, T2 b, T3 q, T4* py){ return ::boost::math::ibetac_inv(a, b, q, py, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta_inva(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_inva(a, b, p, Policy()); }\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type \ + ibetac_inva(T1 a, T2 b, T3 q){ return ::boost::math::ibetac_inva(a, b, q, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta_invb(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_invb(a, b, p, Policy()); }\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type \ + ibetac_invb(T1 a, T2 b, T3 q){ return ::boost::math::ibetac_invb(a, b, q, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibetac_inv(RT1 a, RT2 b, RT3 q){ return ::boost::math::ibetac_inv(a, b, q, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta_derivative(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibeta_derivative(a, b, x, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type erf(RT z) { return ::boost::math::erf(z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type erfc(RT z){ return ::boost::math::erfc(z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type erf_inv(RT z) { return ::boost::math::erf_inv(z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type erfc_inv(RT z){ return ::boost::math::erfc_inv(z, Policy()); }\ +\ + using boost::math::legendre_next;\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + legendre_p(int l, T x){ return ::boost::math::legendre_p(l, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + legendre_q(unsigned l, T x){ return ::boost::math::legendre_q(l, x, Policy()); }\ +\ + using ::boost::math::legendre_next;\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + legendre_p(int l, int m, T x){ return ::boost::math::legendre_p(l, m, x, Policy()); }\ +\ + using ::boost::math::laguerre_next;\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + laguerre(unsigned n, T x){ return ::boost::math::laguerre(n, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::laguerre_result<T1, T2>::type \ + laguerre(unsigned n, T1 m, T2 x) { return ::boost::math::laguerre(n, m, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + hermite(unsigned n, T x){ return ::boost::math::hermite(n, x, Policy()); }\ +\ + using boost::math::hermite_next;\ +\ + template <class T1, class T2>\ + inline std::complex<typename boost::math::tools::promote_args<T1, T2>::type> \ + spherical_harmonic(unsigned n, int m, T1 theta, T2 phi){ return boost::math::spherical_harmonic(n, m, theta, phi, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi){ return ::boost::math::spherical_harmonic_r(n, m, theta, phi, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi){ return boost::math::spherical_harmonic_i(n, m, theta, phi, Policy()); }\ +\ + template <class T1, class T2, class Policy>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol);\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type \ + ellint_rf(T1 x, T2 y, T3 z){ return ::boost::math::ellint_rf(x, y, z, Policy()); }\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type \ + ellint_rd(T1 x, T2 y, T3 z){ return ::boost::math::ellint_rd(x, y, z, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + ellint_rc(T1 x, T2 y){ return ::boost::math::ellint_rc(x, y, Policy()); }\ +\ + template <class T1, class T2, class T3, class T4>\ + inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \ + ellint_rj(T1 x, T2 y, T3 z, T4 p){ return boost::math::ellint_rj(x, y, z, p, Policy()); }\ +\ + template <typename T>\ + inline typename boost::math::tools::promote_args<T>::type ellint_2(T k){ return boost::math::ellint_2(k, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi){ return boost::math::ellint_2(k, phi, Policy()); }\ +\ + template <typename T>\ + inline typename boost::math::tools::promote_args<T>::type ellint_1(T k){ return boost::math::ellint_1(k, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi){ return boost::math::ellint_1(k, phi, Policy()); }\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi){ return boost::math::ellint_3(k, v, phi, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type ellint_3(T1 k, T2 v){ return boost::math::ellint_3(k, v, Policy()); }\ +\ + using boost::math::max_factorial;\ + template <class RT>\ + inline RT factorial(unsigned int i) { return boost::math::factorial<RT>(i, Policy()); }\ + using boost::math::unchecked_factorial;\ + template <class RT>\ + inline RT double_factorial(unsigned i){ return boost::math::double_factorial<RT>(i, Policy()); }\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type falling_factorial(RT x, unsigned n){ return boost::math::falling_factorial(x, n, Policy()); }\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type rising_factorial(RT x, unsigned n){ return boost::math::rising_factorial(x, n, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type tgamma(RT z){ return boost::math::tgamma(z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type tgamma1pm1(RT z){ return boost::math::tgamma1pm1(z, Policy()); }\ +\ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type tgamma(RT1 a, RT2 z){ return boost::math::tgamma(a, z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type lgamma(RT z, int* sign){ return boost::math::lgamma(z, sign, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type lgamma(RT x){ return boost::math::lgamma(x, Policy()); }\ +\ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type tgamma_lower(RT1 a, RT2 z){ return boost::math::tgamma_lower(a, z, Policy()); }\ +\ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type gamma_q(RT1 a, RT2 z){ return boost::math::gamma_q(a, z, Policy()); }\ +\ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type gamma_p(RT1 a, RT2 z){ return boost::math::gamma_p(a, z, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type tgamma_delta_ratio(T1 z, T2 delta){ return boost::math::tgamma_delta_ratio(z, delta, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type tgamma_ratio(T1 a, T2 b) { return boost::math::tgamma_ratio(a, b, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_p_derivative(T1 a, T2 x){ return boost::math::gamma_p_derivative(a, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_p_inv(T1 a, T2 p){ return boost::math::gamma_p_inv(a, p, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_p_inva(T1 a, T2 p){ return boost::math::gamma_p_inva(a, p, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_q_inv(T1 a, T2 q){ return boost::math::gamma_q_inv(a, q, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_q_inva(T1 a, T2 q){ return boost::math::gamma_q_inva(a, q, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type digamma(T x){ return boost::math::digamma(x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + hypot(T1 x, T2 y){ return boost::math::hypot(x, y, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type cbrt(RT z){ return boost::math::cbrt(z, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type log1p(T x){ return boost::math::log1p(x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type log1pmx(T x){ return boost::math::log1pmx(x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type expm1(T x){ return boost::math::expm1(x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + powm1(const T1 a, const T2 z){ return boost::math::powm1(a, z, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type sqrt1pm1(const T& val){ return boost::math::sqrt1pm1(val, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type sinc_pi(T x){ return boost::math::sinc_pi(x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type sinhc_pi(T x){ return boost::math::sinhc_pi(x, Policy()); }\ +\ + template<typename T>\ + inline typename boost::math::tools::promote_args<T>::type asinh(const T x){ return boost::math::asinh(x, Policy()); }\ +\ + template<typename T>\ + inline typename boost::math::tools::promote_args<T>::type acosh(const T x){ return boost::math::acosh(x, Policy()); }\ +\ + template<typename T>\ + inline typename boost::math::tools::promote_args<T>::type atanh(const T x){ return boost::math::atanh(x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type cyl_bessel_j(T1 v, T2 x)\ + { return boost::math::cyl_bessel_j(v, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type sph_bessel(unsigned v, T x)\ + { return boost::math::sph_bessel(v, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ + cyl_bessel_i(T1 v, T2 x) { return boost::math::cyl_bessel_i(v, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ + cyl_bessel_k(T1 v, T2 x) { return boost::math::cyl_bessel_k(v, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ + cyl_neumann(T1 v, T2 x){ return boost::math::cyl_neumann(v, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type \ + sph_neumann(unsigned v, T x){ return boost::math::sph_neumann(v, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type sin_pi(T x){ return boost::math::sin_pi(x); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type cos_pi(T x){ return boost::math::cos_pi(x); }\ +\ + using boost::math::fpclassify;\ + using boost::math::isfinite;\ + using boost::math::isinf;\ + using boost::math::isnan;\ + using boost::math::isnormal;\ + using boost::math::signbit;\ + using boost::math::sign;\ + using boost::math::copysign;\ + using boost::math::changesign;\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T,U>::type expint(T const& z, U const& u)\ + { return boost::math::expint(z, u, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type expint(T z){ return boost::math::expint(z, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type zeta(T s){ return boost::math::zeta(s, Policy()); }\ + \ + template <class T>\ + inline T round(const T& v){ using boost::math::round; return round(v, Policy()); }\ + \ + template <class T>\ + inline int iround(const T& v){ using boost::math::iround; return iround(v, Policy()); }\ + \ + template <class T>\ + inline long lround(const T& v){ using boost::math::lround; return lround(v, Policy()); }\ + \ + template <class T>\ + inline T trunc(const T& v){ using boost::math::trunc; return trunc(v, Policy()); }\ + \ + template <class T>\ + inline int itrunc(const T& v){ using boost::math::itrunc; return itrunc(v, Policy()); }\ + \ + template <class T>\ + inline long ltrunc(const T& v){ using boost::math::ltrunc; return ltrunc(v, Policy()); }\ + \ + template <class T>\ + inline T modf(const T& v, T* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + \ + template <class T>\ + inline T modf(const T& v, int* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + \ + template <class T>\ + inline T modf(const T& v, long* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + \ + template <int N, class T>\ + inline typename boost::math::tools::promote_args<T>::type pow(T v){ return boost::math::pow<N>(v, Policy()); }\ + \ + template <class T> T nextafter(const T& a, const T& b){ return boost::math::nextafter(a, b, Policy()); }\ + template <class T> T float_next(const T& a){ return boost::math::float_next(a, Policy()); }\ + template <class T> T float_prior(const T& a){ return boost::math::float_prior(a, Policy()); }\ + template <class T> T float_distance(const T& a, const T& b){ return boost::math::float_distance(a, b, Policy()); }\ + \ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type owens_t(RT1 a, RT2 z){ return boost::math::owens_t(a, z, Policy()); }\ + \ + template <class T1, class T2>\ + inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> cyl_hankel_1(T1 v, T2 x)\ + { return boost::math::cyl_hankel_1(v, x, Policy()); }\ + \ + template <class T1, class T2>\ + inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> cyl_hankel_2(T1 v, T2 x)\ + { return boost::math::cyl_hankel_2(v, x, Policy()); }\ + \ + template <class T1, class T2>\ + inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> sph_hankel_1(T1 v, T2 x)\ + { return boost::math::sph_hankel_1(v, x, Policy()); }\ + \ + template <class T1, class T2>\ + inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> sph_hankel_2(T1 v, T2 x)\ + { return boost::math::sph_hankel_2(v, x, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type jacobi_elliptic(T k, T theta, T* pcn, T* pdn)\ + { return boost::math::jacobi_elliptic(k, theta, pcn, pdn, Policy()); }\ + \ + template <class U, class T>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_sn(U k, T theta)\ + { return boost::math::jacobi_sn(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_cn(T k, U theta)\ + { return boost::math::jacobi_cn(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_dn(T k, U theta)\ + { return boost::math::jacobi_dn(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_cd(T k, U theta)\ + { return boost::math::jacobi_cd(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_dc(T k, U theta)\ + { return boost::math::jacobi_dc(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_ns(T k, U theta)\ + { return boost::math::jacobi_ns(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_sd(T k, U theta)\ + { return boost::math::jacobi_sd(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_ds(T k, U theta)\ + { return boost::math::jacobi_ds(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_nc(T k, U theta)\ + { return boost::math::jacobi_nc(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_nd(T k, U theta)\ + { return boost::math::jacobi_nd(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_sc(T k, U theta)\ + { return boost::math::jacobi_sc(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_cs(T k, U theta)\ + { return boost::math::jacobi_cs(k, theta, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type airy_ai(T x)\ + { return boost::math::airy_ai(x, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type airy_bi(T x)\ + { return boost::math::airy_bi(x, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type airy_ai_prime(T x)\ + { return boost::math::airy_ai_prime(x, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type airy_bi_prime(T x)\ + { return boost::math::airy_bi_prime(x, Policy()); }\ + \ + + + + + +#endif // BOOST_MATH_SPECIAL_MATH_FWD_HPP + + diff --git a/3rdParty/Boost/src/boost/math/special_functions/sign.hpp b/3rdParty/Boost/src/boost/math/special_functions/sign.hpp new file mode 100644 index 0000000..6de88b2 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/sign.hpp @@ -0,0 +1,145 @@ +// (C) Copyright John Maddock 2006. +// (C) Copyright Johan Rade 2006. +// (C) Copyright Paul A. Bristow 2011 (added changesign). + +// 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_SIGN_HPP +#define BOOST_MATH_TOOLS_SIGN_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include <boost/math/tools/config.hpp> +#include <boost/math/special_functions/math_fwd.hpp> +#include <boost/math/special_functions/detail/fp_traits.hpp> + +namespace boost{ namespace math{ + +namespace detail { + + // signbit + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline int signbit_impl(T x, native_tag const&) + { + return (std::signbit)(x); + } +#endif + + template<class T> + inline int signbit_impl(T x, generic_tag<true> const&) + { + return x < 0; + } + + template<class T> + inline int signbit_impl(T x, generic_tag<false> const&) + { + return x < 0; + } + + template<class T> + inline int signbit_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + return a & traits::sign ? 1 : 0; + } + + template<class T> + inline int signbit_impl(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + + return a & traits::sign ? 1 : 0; + } + + // Changesign + + template<class T> + inline T (changesign_impl)(T x, generic_tag<true> const&) + { + return -x; + } + + template<class T> + inline T (changesign_impl)(T x, generic_tag<false> const&) + { + return -x; + } + + + template<class T> + inline T changesign_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::sign_change_type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a ^= traits::sign; + traits::set_bits(x,a); + return x; + } + + template<class T> + inline T (changesign_impl)(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::sign_change_type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a ^= traits::sign; + traits::set_bits(x,a); + return x; + } + + +} // namespace detail + +template<class T> int (signbit)(T x) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + return detail::signbit_impl(x, method()); +} + +template <class T> +inline int sign BOOST_NO_MACRO_EXPAND(const T& z) +{ + return (z == 0) ? 0 : (boost::math::signbit)(z) ? -1 : 1; +} + +template<class T> T (changesign)(const T& x) +{ //!< \brief return unchanged binary pattern of x, except for change of sign bit. + typedef typename detail::fp_traits<T>::sign_change_type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + + return detail::changesign_impl(x, method()); +} + +template <class T> +inline T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y) +{ + BOOST_MATH_STD_USING + return (boost::math::signbit)(x) != (boost::math::signbit)(y) ? (boost::math::changesign)(x) : x; +} + +} // namespace math +} // namespace boost + + +#endif // BOOST_MATH_TOOLS_SIGN_HPP + + |