]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/math/cstdfloat/cstdfloat_limits.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / math / cstdfloat / cstdfloat_limits.hpp
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_MATH_CSTDFLOAT_LIMITS_2014_01_09_HPP_
13 #define BOOST_MATH_CSTDFLOAT_LIMITS_2014_01_09_HPP_
14
15 #include <boost/math/cstdfloat/cstdfloat_types.hpp>
16
17 #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128)
18 //
19 // This is the only way we can avoid
20 // warning: non-standard suffix on floating constant [-Wpedantic]
21 // when building with -Wall -pedantic. Neither __extension__
22 // nor #pragma diagnostic ignored work :(
23 //
24 #pragma GCC system_header
25 #endif
26
27 #if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT)
28
29 #include <limits>
30
31 // Define the name of the global quadruple-precision function to be used for
32 // calculating quiet_NaN() in the specialization of std::numeric_limits<>.
33 #if defined(__INTEL_COMPILER)
34 #define BOOST_CSTDFLOAT_FLOAT128_SQRT __sqrtq
35 #elif defined(__GNUC__)
36 #define BOOST_CSTDFLOAT_FLOAT128_SQRT sqrtq
37 #endif
38
39 // Forward declaration of the quadruple-precision square root function.
40 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SQRT(boost::math::cstdfloat::detail::float_internal128_t) throw();
41
42 namespace std
43 {
44 template<>
45 class numeric_limits<boost::math::cstdfloat::detail::float_internal128_t>
46 {
47 public:
48 static constexpr bool is_specialized = true;
49 static boost::math::cstdfloat::detail::float_internal128_t (min) () noexcept { return BOOST_CSTDFLOAT_FLOAT128_MIN; }
50 static boost::math::cstdfloat::detail::float_internal128_t (max) () noexcept { return BOOST_CSTDFLOAT_FLOAT128_MAX; }
51 static boost::math::cstdfloat::detail::float_internal128_t lowest() noexcept { return -(max)(); }
52 static constexpr int digits = 113;
53 static constexpr int digits10 = 33;
54 static constexpr int max_digits10 = 36;
55 static constexpr bool is_signed = true;
56 static constexpr bool is_integer = false;
57 static constexpr bool is_exact = false;
58 static constexpr int radix = 2;
59 static boost::math::cstdfloat::detail::float_internal128_t epsilon () { return BOOST_CSTDFLOAT_FLOAT128_EPS; }
60 static boost::math::cstdfloat::detail::float_internal128_t round_error() { return BOOST_FLOAT128_C(0.5); }
61 static constexpr int min_exponent = -16381;
62 static constexpr int min_exponent10 = static_cast<int>((min_exponent * 301L) / 1000L);
63 static constexpr int max_exponent = +16384;
64 static constexpr int max_exponent10 = static_cast<int>((max_exponent * 301L) / 1000L);
65 static constexpr bool has_infinity = true;
66 static constexpr bool has_quiet_NaN = true;
67 static constexpr bool has_signaling_NaN = false;
68 static constexpr float_denorm_style has_denorm = denorm_present;
69 static constexpr bool has_denorm_loss = false;
70 static boost::math::cstdfloat::detail::float_internal128_t infinity () { return BOOST_FLOAT128_C(1.0) / BOOST_FLOAT128_C(0.0); }
71 static boost::math::cstdfloat::detail::float_internal128_t quiet_NaN () { return -(::BOOST_CSTDFLOAT_FLOAT128_SQRT(BOOST_FLOAT128_C(-1.0))); }
72 static boost::math::cstdfloat::detail::float_internal128_t signaling_NaN() { return BOOST_FLOAT128_C(0.0); }
73 static boost::math::cstdfloat::detail::float_internal128_t denorm_min () { return BOOST_CSTDFLOAT_FLOAT128_DENORM_MIN; }
74 static constexpr bool is_iec559 = true;
75 static constexpr bool is_bounded = true;
76 static constexpr bool is_modulo = false;
77 static constexpr bool traps = false;
78 static constexpr bool tinyness_before = false;
79 static constexpr float_round_style round_style = round_to_nearest;
80 };
81 } // namespace std
82
83 #endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)
84
85 #endif // BOOST_MATH_CSTDFLOAT_LIMITS_2014_01_09_HPP_
86