]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Copyright Christopher Kormanyos 2014. | |
3 | // Copyright John Maddock 2014. | |
4 | // Copyright Paul Bristow 2014. | |
5 | // Distributed under the Boost Software License, | |
6 | // Version 1.0. (See accompanying file LICENSE_1_0.txt | |
7 | // or copy at http://www.boost.org/LICENSE_1_0.txt) | |
8 | // | |
9 | ||
10 | // Implement quadruple-precision std::numeric_limits<> support. | |
11 | ||
12 | #ifndef _BOOST_CSTDFLOAT_LIMITS_2014_01_09_HPP_ | |
13 | #define _BOOST_CSTDFLOAT_LIMITS_2014_01_09_HPP_ | |
14 | ||
15 | #include <boost/math/cstdfloat/cstdfloat_types.hpp> | |
16 | ||
17 | #if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT) | |
18 | ||
19 | #include <limits> | |
20 | ||
21 | // Define the name of the global quadruple-precision function to be used for | |
22 | // calculating quiet_NaN() in the specialization of std::numeric_limits<>. | |
23 | #if defined(BOOST_INTEL) | |
24 | #define BOOST_CSTDFLOAT_FLOAT128_SQRT __sqrtq | |
25 | #elif defined(__GNUC__) | |
26 | #define BOOST_CSTDFLOAT_FLOAT128_SQRT sqrtq | |
27 | #endif | |
28 | ||
29 | // Forward declaration of the quadruple-precision square root function. | |
30 | extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SQRT(boost::math::cstdfloat::detail::float_internal128_t) throw(); | |
31 | ||
32 | namespace std | |
33 | { | |
34 | template<> | |
35 | class numeric_limits<boost::math::cstdfloat::detail::float_internal128_t> | |
36 | { | |
37 | public: | |
38 | BOOST_STATIC_CONSTEXPR bool is_specialized = true; | |
39 | static boost::math::cstdfloat::detail::float_internal128_t (min) () BOOST_NOEXCEPT { return BOOST_CSTDFLOAT_FLOAT128_MIN; } | |
40 | static boost::math::cstdfloat::detail::float_internal128_t (max) () BOOST_NOEXCEPT { return BOOST_CSTDFLOAT_FLOAT128_MAX; } | |
41 | static boost::math::cstdfloat::detail::float_internal128_t lowest() BOOST_NOEXCEPT { return -(max)(); } | |
42 | BOOST_STATIC_CONSTEXPR int digits = 113; | |
43 | BOOST_STATIC_CONSTEXPR int digits10 = 33; | |
44 | BOOST_STATIC_CONSTEXPR int max_digits10 = 36; | |
45 | BOOST_STATIC_CONSTEXPR bool is_signed = true; | |
46 | BOOST_STATIC_CONSTEXPR bool is_integer = false; | |
47 | BOOST_STATIC_CONSTEXPR bool is_exact = false; | |
48 | BOOST_STATIC_CONSTEXPR int radix = 2; | |
49 | static boost::math::cstdfloat::detail::float_internal128_t epsilon () { return BOOST_CSTDFLOAT_FLOAT128_EPS; } | |
50 | static boost::math::cstdfloat::detail::float_internal128_t round_error() { return BOOST_FLOAT128_C(0.5); } | |
51 | BOOST_STATIC_CONSTEXPR int min_exponent = -16381; | |
52 | BOOST_STATIC_CONSTEXPR int min_exponent10 = static_cast<int>((min_exponent * 301L) / 1000L); | |
53 | BOOST_STATIC_CONSTEXPR int max_exponent = +16384; | |
54 | BOOST_STATIC_CONSTEXPR int max_exponent10 = static_cast<int>((max_exponent * 301L) / 1000L); | |
55 | BOOST_STATIC_CONSTEXPR bool has_infinity = true; | |
56 | BOOST_STATIC_CONSTEXPR bool has_quiet_NaN = true; | |
57 | BOOST_STATIC_CONSTEXPR bool has_signaling_NaN = false; | |
58 | BOOST_STATIC_CONSTEXPR float_denorm_style has_denorm = denorm_absent; | |
59 | BOOST_STATIC_CONSTEXPR bool has_denorm_loss = false; | |
60 | static boost::math::cstdfloat::detail::float_internal128_t infinity () { return BOOST_FLOAT128_C(1.0) / BOOST_FLOAT128_C(0.0); } | |
61 | static boost::math::cstdfloat::detail::float_internal128_t quiet_NaN () { return ::BOOST_CSTDFLOAT_FLOAT128_SQRT(BOOST_FLOAT128_C(-1.0)); } | |
62 | static boost::math::cstdfloat::detail::float_internal128_t signaling_NaN() { return BOOST_FLOAT128_C(0.0); } | |
63 | static boost::math::cstdfloat::detail::float_internal128_t denorm_min () { return BOOST_FLOAT128_C(0.0); } | |
64 | BOOST_STATIC_CONSTEXPR bool is_iec559 = true; | |
65 | BOOST_STATIC_CONSTEXPR bool is_bounded = false; | |
66 | BOOST_STATIC_CONSTEXPR bool is_modulo = false; | |
67 | BOOST_STATIC_CONSTEXPR bool traps = false; | |
68 | BOOST_STATIC_CONSTEXPR bool tinyness_before = false; | |
69 | BOOST_STATIC_CONSTEXPR float_round_style round_style = round_to_nearest; | |
70 | }; | |
71 | } // namespace std | |
72 | ||
73 | #endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support) | |
74 | ||
75 | #endif // _BOOST_CSTDFLOAT_LIMITS_2014_01_09_HPP_ |