summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-10-19 20:22:58 (GMT)
committerTobias Markmann <tm@ayena.de>2014-10-20 13:49:33 (GMT)
commit6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch)
tree2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp
parent38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff)
downloadswift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip
swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0. Updated our update.sh script to stop on error. Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to missing include of <iostream> with newer Boost. Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp')
-rw-r--r--3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp167
1 files changed, 118 insertions, 49 deletions
diff --git a/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp
index 6f92d18..40f6e14 100644
--- a/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp
+++ b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp
@@ -37,13 +37,13 @@ the template is never instantiated.
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),
+ 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,
+ 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,
+ 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,
@@ -56,7 +56,7 @@ at compile time, then the following algorithm is used:
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,
@@ -85,7 +85,7 @@ is used.
namespace std{ using ::abs; using ::fabs; }
#endif
-namespace boost{
+namespace boost{
//
// This must not be located in any namespace under boost::math
@@ -94,18 +94,28 @@ namespace boost{
//
namespace math_detail{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4800)
+#endif
+
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)
+ (void)t;
return false;
#else // BOOST_HAS_FPCLASSIFY
return (BOOST_FPCLASSIFY_PREFIX fpclassify(t) == (int)FP_NAN);
#endif
}
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
template <class T>
inline bool is_nan_helper(T, const boost::false_type&)
{
@@ -169,7 +179,7 @@ inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<false>&)
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?
//
@@ -178,7 +188,7 @@ inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<false>&)
return t == 0 ? FP_ZERO : FP_NORMAL;
}
-template<class T>
+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;
@@ -207,7 +217,7 @@ int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_all_bits_tag)
return FP_NAN;
}
-template<class T>
+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;
@@ -215,7 +225,7 @@ int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag)
BOOST_MATH_INSTRUMENT_VARIABLE(x);
BOOST_DEDUCED_TYPENAME traits::bits a;
- traits::get_bits(x,a);
+ traits::get_bits(x,a);
a &= traits::exponent | traits::flag | traits::significand;
if(a <= traits::significand) {
@@ -234,9 +244,8 @@ int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag)
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&)
+#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && (defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) || defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS))
+inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
{
return boost::math::detail::fpclassify_imp(t, generic_tag<true>());
}
@@ -249,7 +258,7 @@ 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;
+ typedef typename tools::promote_args_permissive<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>());
@@ -259,24 +268,41 @@ inline int fpclassify BOOST_NO_MACRO_EXPAND(T t)
#endif
}
+#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+template <>
+inline int fpclassify<long double> BOOST_NO_MACRO_EXPAND(long double t)
+{
+ typedef detail::fp_traits<long double>::type traits;
+ typedef traits::method method;
+ typedef long double value_type;
+#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+ if(std::numeric_limits<long double>::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
+}
+#endif
+
namespace detail {
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
- template<class T>
+ template<class T>
inline bool isfinite_impl(T x, native_tag const&)
{
return (std::isfinite)(x);
}
#endif
- template<class T>
+ 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>
+ template<class T>
inline bool isfinite_impl(T x, generic_tag<false> const&)
{
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
@@ -287,7 +313,7 @@ namespace detail {
return true;
}
- template<class T>
+ template<class T>
inline bool isfinite_impl(T x, ieee_tag const&)
{
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
@@ -298,8 +324,7 @@ namespace detail {
}
#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&)
+inline bool isfinite_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
{
return boost::math::detail::isfinite_impl(t, generic_tag<true>());
}
@@ -307,29 +332,41 @@ inline bool isfinite_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, cons
}
-template<class T>
+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;
+ // typedef typename boost::is_floating_point<T>::type fp_tag;
+ typedef typename tools::promote_args_permissive<T>::type value_type;
return detail::isfinite_impl(static_cast<value_type>(x), method());
}
+#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+template<>
+inline bool (isfinite)(long double x)
+{ //!< \brief return true if floating-point type t is finite.
+ typedef detail::fp_traits<long double>::type traits;
+ typedef traits::method method;
+ //typedef boost::is_floating_point<long double>::type fp_tag;
+ typedef long double value_type;
+ return detail::isfinite_impl(static_cast<value_type>(x), method());
+}
+#endif
+
//------------------------------------------------------------------------------
namespace detail {
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
- template<class T>
+ template<class T>
inline bool isnormal_impl(T x, native_tag const&)
{
return (std::isnormal)(x);
}
#endif
- template<class T>
+ template<class T>
inline bool isnormal_impl(T x, generic_tag<true> const&)
{
if(x < 0) x = -x;
@@ -337,7 +374,7 @@ namespace detail {
&& x <= (std::numeric_limits<T>::max)();
}
- template<class T>
+ template<class T>
inline bool isnormal_impl(T x, generic_tag<false> const&)
{
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
@@ -347,7 +384,7 @@ namespace detail {
return !(x == 0);
}
- template<class T>
+ template<class T>
inline bool isnormal_impl(T x, ieee_tag const&)
{
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
@@ -358,8 +395,7 @@ namespace detail {
}
#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&)
+inline bool isnormal_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
{
return boost::math::detail::isnormal_impl(t, generic_tag<true>());
}
@@ -367,38 +403,50 @@ inline bool isnormal_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, cons
}
-template<class T>
+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;
+ //typedef typename boost::is_floating_point<T>::type fp_tag;
+ typedef typename tools::promote_args_permissive<T>::type value_type;
return detail::isnormal_impl(static_cast<value_type>(x), method());
}
+#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+template<>
+inline bool (isnormal)(long double x)
+{
+ typedef detail::fp_traits<long double>::type traits;
+ typedef traits::method method;
+ //typedef boost::is_floating_point<long double>::type fp_tag;
+ typedef long double value_type;
+ return detail::isnormal_impl(static_cast<value_type>(x), method());
+}
+#endif
+
//------------------------------------------------------------------------------
namespace detail {
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
- template<class T>
+ template<class T>
inline bool isinf_impl(T x, native_tag const&)
{
return (std::isinf)(x);
}
#endif
- template<class T>
+ 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
+ return std::numeric_limits<T>::has_infinity
&& ( x == std::numeric_limits<T>::infinity()
|| x == -std::numeric_limits<T>::infinity());
}
- template<class T>
+ template<class T>
inline bool isinf_impl(T x, generic_tag<false> const&)
{
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
@@ -409,7 +457,7 @@ namespace detail {
return false;
}
- template<class T>
+ template<class T>
inline bool isinf_impl(T x, ieee_copy_all_bits_tag const&)
{
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
@@ -420,7 +468,7 @@ namespace detail {
return a == traits::exponent;
}
- template<class T>
+ template<class T>
inline bool isinf_impl(T x, ieee_copy_leading_bits_tag const&)
{
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
@@ -436,8 +484,7 @@ namespace detail {
}
#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&)
+inline bool isinf_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
{
return boost::math::detail::isinf_impl(t, generic_tag<true>());
}
@@ -445,29 +492,41 @@ inline bool isinf_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const n
} // namespace detail
-template<class T>
+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;
+ // typedef typename boost::is_floating_point<T>::type fp_tag;
+ typedef typename tools::promote_args_permissive<T>::type value_type;
+ return detail::isinf_impl(static_cast<value_type>(x), method());
+}
+
+#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+template<>
+inline bool (isinf)(long double x)
+{
+ typedef detail::fp_traits<long double>::type traits;
+ typedef traits::method method;
+ //typedef boost::is_floating_point<long double>::type fp_tag;
+ typedef long double value_type;
return detail::isinf_impl(static_cast<value_type>(x), method());
}
+#endif
//------------------------------------------------------------------------------
namespace detail {
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
- template<class T>
+ template<class T>
inline bool isnan_impl(T x, native_tag const&)
{
return (std::isnan)(x);
}
#endif
- template<class T>
+ template<class T>
inline bool isnan_impl(T x, generic_tag<true> const&)
{
return std::numeric_limits<T>::has_infinity
@@ -475,7 +534,7 @@ namespace detail {
: x != x;
}
- template<class T>
+ template<class T>
inline bool isnan_impl(T x, generic_tag<false> const&)
{
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
@@ -486,7 +545,7 @@ namespace detail {
return false;
}
- template<class T>
+ template<class T>
inline bool isnan_impl(T x, ieee_copy_all_bits_tag const&)
{
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
@@ -497,7 +556,7 @@ namespace detail {
return a > traits::exponent;
}
- template<class T>
+ template<class T>
inline bool isnan_impl(T x, ieee_copy_leading_bits_tag const&)
{
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
@@ -516,11 +575,12 @@ namespace detail {
} // namespace detail
-template<class T> bool (isnan)(T x)
+template<class T>
+inline 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;
+ // typedef typename boost::is_floating_point<T>::type fp_tag;
return detail::isnan_impl(x, method());
}
@@ -528,6 +588,15 @@ template<class T> bool (isnan)(T x)
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()); }
+#elif defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
+template<>
+inline bool (isnan)(long double x)
+{ //!< \brief return true if floating-point type t is NaN (Not A Number).
+ typedef detail::fp_traits<long double>::type traits;
+ typedef traits::method method;
+ //typedef boost::is_floating_point<long double>::type fp_tag;
+ return detail::isnan_impl(x, method());
+}
#endif
} // namespace math