#pragma once
#endif
-#include <math.h>
-#include <boost/config/no_tr1/cmath.hpp>
-#include <boost/limits.hpp>
+#include <limits>
+#include <type_traits>
+#include <cmath>
#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>
/*!
//
namespace math_detail{
-#ifdef BOOST_MSVC
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4800)
#endif
template <class T>
-inline bool is_nan_helper(T t, const boost::true_type&)
+inline bool is_nan_helper(T t, const std::true_type&)
{
#ifdef isnan
return isnan(t);
#endif
}
-#ifdef BOOST_MSVC
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
template <class T>
-inline bool is_nan_helper(T, const boost::false_type&)
+inline bool is_nan_helper(T, const std::false_type&)
{
return false;
}
#if defined(BOOST_MATH_USE_FLOAT128)
#if defined(BOOST_MATH_HAS_QUADMATH_H)
-inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnanq(f); }
-inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnanq(f); }
+inline bool is_nan_helper(__float128 f, const std::true_type&) { return ::isnanq(f); }
+inline bool is_nan_helper(__float128 f, const std::false_type&) { return ::isnanq(f); }
#elif defined(BOOST_GNU_STDLIB) && BOOST_GNU_STDLIB && \
_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
-inline bool is_nan_helper(__float128 f, const boost::true_type&) { return std::isnan(static_cast<double>(f)); }
-inline bool is_nan_helper(__float128 f, const boost::false_type&) { return std::isnan(static_cast<double>(f)); }
+inline bool is_nan_helper(__float128 f, const std::true_type&) { return std::isnan(static_cast<double>(f)); }
+inline bool is_nan_helper(__float128 f, const std::false_type&) { return std::isnan(static_cast<double>(f)); }
#else
-inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnan(static_cast<double>(f)); }
-inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnan(static_cast<double>(f)); }
+inline bool is_nan_helper(__float128 f, const std::true_type&) { return boost::math::isnan(static_cast<double>(f)); }
+inline bool is_nan_helper(__float128 f, const std::false_type&) { return boost::math::isnan(static_cast<double>(f)); }
#endif
#endif
}
// 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>()))
+ if(::boost::math_detail::is_nan_helper(t, typename std::is_floating_point<T>::type()))
return FP_NAN;
#elif defined(isnan)
- if(boost::math_detail::is_nan_helper(t, ::boost::is_floating_point<T>()))
+ if(boost::math_detail::is_nan_helper(t, typename std::is_floating_point<T>::type()))
return FP_NAN;
#elif defined(_MSC_VER) || defined(BOOST_BORLANDC)
if(::_isnan(boost::math::tools::real_cast<double>(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;
+ typedef typename fp_traits<T>::type traits;
BOOST_MATH_INSTRUMENT_VARIABLE(x);
- BOOST_DEDUCED_TYPENAME traits::bits a;
+ typename traits::bits a;
traits::get_bits(x,a);
BOOST_MATH_INSTRUMENT_VARIABLE(a);
a &= traits::exponent | traits::flag | traits::significand;
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;
+ typedef typename fp_traits<T>::type traits;
BOOST_MATH_INSTRUMENT_VARIABLE(x);
- BOOST_DEDUCED_TYPENAME traits::bits a;
+ typename traits::bits a;
traits::get_bits(x,a);
a &= traits::exponent | traits::flag | traits::significand;
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;
+ typedef typename detail::fp_traits<T>::type traits;
+ typename traits::bits a;
traits::get_bits(x,a);
a &= traits::exponent;
return a != traits::exponent;
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;
+ typedef typename detail::fp_traits<T>::type traits;
+ typename traits::bits a;
traits::get_bits(x,a);
a &= traits::exponent | traits::flag;
return (a != 0) && (a < traits::exponent);
template<class T>
inline bool isinf_impl(T x, ieee_copy_all_bits_tag const&)
{
- typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
+ typedef typename fp_traits<T>::type traits;
- BOOST_DEDUCED_TYPENAME traits::bits a;
+ 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;
+ typedef typename fp_traits<T>::type traits;
- BOOST_DEDUCED_TYPENAME traits::bits a;
+ typename traits::bits a;
traits::get_bits(x,a);
a &= traits::exponent | traits::significand;
if(a != traits::exponent)
template<class T>
inline bool isnan_impl(T x, ieee_copy_all_bits_tag const&)
{
- typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
+ typedef typename fp_traits<T>::type traits;
- BOOST_DEDUCED_TYPENAME traits::bits a;
+ 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;
+ typedef typename fp_traits<T>::type traits;
- BOOST_DEDUCED_TYPENAME traits::bits a;
+ typename traits::bits a;
traits::get_bits(x,a);
a &= traits::exponent | traits::significand;
}
#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()); }
+template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, std::true_type()); }
+template <> inline bool isnan BOOST_NO_MACRO_EXPAND<double>(double t){ return ::boost::math_detail::is_nan_helper(t, std::true_type()); }
+template <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){ return ::boost::math_detail::is_nan_helper(t, std::true_type()); }
#elif defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
template<>
inline bool (isnan)(long double x)
} // namespace math
} // namespace boost
-
#endif // BOOST_MATH_FPCLASSIFY_HPP