Chris@102: /////////////////////////////////////////////////////////////////////////////// Chris@102: // Copyright Christopher Kormanyos 2014. Chris@102: // Copyright John Maddock 2014. Chris@102: // Copyright Paul Bristow 2014. Chris@102: // Distributed under the Boost Software License, Chris@102: // Version 1.0. (See accompanying file LICENSE_1_0.txt Chris@102: // or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@102: // Chris@102: Chris@102: // Implement quadruple-precision std::numeric_limits<> support. Chris@102: Chris@102: #ifndef _BOOST_CSTDFLOAT_LIMITS_2014_01_09_HPP_ Chris@102: #define _BOOST_CSTDFLOAT_LIMITS_2014_01_09_HPP_ Chris@102: Chris@102: #include Chris@102: Chris@102: #if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT) Chris@102: Chris@102: #include Chris@102: Chris@102: // Define the name of the global quadruple-precision function to be used for Chris@102: // calculating quiet_NaN() in the specialization of std::numeric_limits<>. Chris@102: #if defined(BOOST_INTEL) Chris@102: #define BOOST_CSTDFLOAT_FLOAT128_SQRT __sqrtq Chris@102: #elif defined(__GNUC__) Chris@102: #define BOOST_CSTDFLOAT_FLOAT128_SQRT sqrtq Chris@102: #endif Chris@102: Chris@102: // Forward declaration of the quadruple-precision square root function. Chris@102: extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SQRT(boost::math::cstdfloat::detail::float_internal128_t) throw(); Chris@102: Chris@102: namespace std Chris@102: { Chris@102: template<> Chris@102: class numeric_limits Chris@102: { Chris@102: public: Chris@102: BOOST_STATIC_CONSTEXPR bool is_specialized = true; Chris@102: static boost::math::cstdfloat::detail::float_internal128_t (min) () BOOST_NOEXCEPT { return BOOST_CSTDFLOAT_FLOAT128_MIN; } Chris@102: static boost::math::cstdfloat::detail::float_internal128_t (max) () BOOST_NOEXCEPT { return BOOST_CSTDFLOAT_FLOAT128_MAX; } Chris@102: static boost::math::cstdfloat::detail::float_internal128_t lowest() BOOST_NOEXCEPT { return -(max)(); } Chris@102: BOOST_STATIC_CONSTEXPR int digits = 113; Chris@102: BOOST_STATIC_CONSTEXPR int digits10 = 34; Chris@102: BOOST_STATIC_CONSTEXPR int max_digits10 = 36; Chris@102: BOOST_STATIC_CONSTEXPR bool is_signed = true; Chris@102: BOOST_STATIC_CONSTEXPR bool is_integer = false; Chris@102: BOOST_STATIC_CONSTEXPR bool is_exact = false; Chris@102: BOOST_STATIC_CONSTEXPR int radix = 2; Chris@102: static boost::math::cstdfloat::detail::float_internal128_t epsilon () { return BOOST_CSTDFLOAT_FLOAT128_EPS; } Chris@102: static boost::math::cstdfloat::detail::float_internal128_t round_error() { return BOOST_FLOAT128_C(0.5); } Chris@102: BOOST_STATIC_CONSTEXPR int min_exponent = -16381; Chris@102: BOOST_STATIC_CONSTEXPR int min_exponent10 = static_cast((min_exponent * 301L) / 1000L); Chris@102: BOOST_STATIC_CONSTEXPR int max_exponent = +16384; Chris@102: BOOST_STATIC_CONSTEXPR int max_exponent10 = static_cast((max_exponent * 301L) / 1000L); Chris@102: BOOST_STATIC_CONSTEXPR bool has_infinity = true; Chris@102: BOOST_STATIC_CONSTEXPR bool has_quiet_NaN = true; Chris@102: BOOST_STATIC_CONSTEXPR bool has_signaling_NaN = false; Chris@102: BOOST_STATIC_CONSTEXPR float_denorm_style has_denorm = denorm_absent; Chris@102: BOOST_STATIC_CONSTEXPR bool has_denorm_loss = false; Chris@102: static boost::math::cstdfloat::detail::float_internal128_t infinity () { return BOOST_FLOAT128_C(1.0) / BOOST_FLOAT128_C(0.0); } Chris@102: static boost::math::cstdfloat::detail::float_internal128_t quiet_NaN () { return ::BOOST_CSTDFLOAT_FLOAT128_SQRT(BOOST_FLOAT128_C(-1.0)); } Chris@102: static boost::math::cstdfloat::detail::float_internal128_t signaling_NaN() { return BOOST_FLOAT128_C(0.0); } Chris@102: static boost::math::cstdfloat::detail::float_internal128_t denorm_min () { return BOOST_FLOAT128_C(0.0); } Chris@102: BOOST_STATIC_CONSTEXPR bool is_iec559 = true; Chris@102: BOOST_STATIC_CONSTEXPR bool is_bounded = false; Chris@102: BOOST_STATIC_CONSTEXPR bool is_modulo = false; Chris@102: BOOST_STATIC_CONSTEXPR bool traps = false; Chris@102: BOOST_STATIC_CONSTEXPR bool tinyness_before = false; Chris@102: BOOST_STATIC_CONSTEXPR float_round_style round_style = round_to_nearest; Chris@102: }; Chris@102: } // namespace std Chris@102: Chris@102: #endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support) Chris@102: Chris@102: #endif // _BOOST_CSTDFLOAT_LIMITS_2014_01_09_HPP_