Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:36

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // Copyright Christopher Kormanyos 2014.
0003 // Copyright John Maddock 2014.
0004 // Copyright Paul Bristow 2014.
0005 // Distributed under the Boost Software License,
0006 // Version 1.0. (See accompanying file LICENSE_1_0.txt
0007 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 
0010 // Implement quadruple-precision std::numeric_limits<> support.
0011 
0012 #ifndef BOOST_MATH_CSTDFLOAT_LIMITS_2014_01_09_HPP_
0013   #define BOOST_MATH_CSTDFLOAT_LIMITS_2014_01_09_HPP_
0014 
0015   #include <boost/math/cstdfloat/cstdfloat_types.hpp>
0016 
0017 #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128)
0018 //
0019 // This is the only way we can avoid
0020 // warning: non-standard suffix on floating constant [-Wpedantic]
0021 // when building with -Wall -pedantic.  Neither __extension__
0022 // nor #pragma diagnostic ignored work :(
0023 //
0024 #pragma GCC system_header
0025 #endif
0026 
0027   #if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT) && (!defined(__GNUC__) || (defined(__GNUC__) && __GNUC__ < 14))
0028 
0029     #include <limits>
0030     #include <boost/math/tools/nothrow.hpp>
0031 
0032     // Define the name of the global quadruple-precision function to be used for
0033     // calculating quiet_NaN() in the specialization of std::numeric_limits<>.
0034     #if defined(__INTEL_COMPILER)
0035       #define BOOST_CSTDFLOAT_FLOAT128_SQRT   __sqrtq
0036     #elif defined(__GNUC__)
0037       #define BOOST_CSTDFLOAT_FLOAT128_SQRT   sqrtq
0038     #endif
0039 
0040     // Forward declaration of the quadruple-precision square root function.
0041     extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SQRT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
0042 
0043     namespace std
0044     {
0045       template<>
0046       class numeric_limits<boost::math::cstdfloat::detail::float_internal128_t>
0047       {
0048       public:
0049         static constexpr bool                                                 is_specialized           = true;
0050         static                 boost::math::cstdfloat::detail::float_internal128_t  (min) () noexcept  { return BOOST_CSTDFLOAT_FLOAT128_MIN; }
0051         static                 boost::math::cstdfloat::detail::float_internal128_t  (max) () noexcept  { return BOOST_CSTDFLOAT_FLOAT128_MAX; }
0052         static                 boost::math::cstdfloat::detail::float_internal128_t  lowest() noexcept  { return -(max)(); }
0053         static constexpr int                                                  digits                   = 113;
0054         static constexpr int                                                  digits10                 = 33;
0055         static constexpr int                                                  max_digits10             = 36;
0056         static constexpr bool                                                 is_signed                = true;
0057         static constexpr bool                                                 is_integer               = false;
0058         static constexpr bool                                                 is_exact                 = false;
0059         static constexpr int                                                  radix                    = 2;
0060         static                 boost::math::cstdfloat::detail::float_internal128_t  epsilon    ()            { return BOOST_CSTDFLOAT_FLOAT128_EPS; }
0061         static                 boost::math::cstdfloat::detail::float_internal128_t  round_error()            { return BOOST_FLOAT128_C(0.5); }
0062         static constexpr int                                                  min_exponent             = -16381;
0063         static constexpr int                                                  min_exponent10           = static_cast<int>((min_exponent * 301L) / 1000L);
0064         static constexpr int                                                  max_exponent             = +16384;
0065         static constexpr int                                                  max_exponent10           = static_cast<int>((max_exponent * 301L) / 1000L);
0066         static constexpr bool                                                 has_infinity             = true;
0067         static constexpr bool                                                 has_quiet_NaN            = true;
0068         static constexpr bool                                                 has_signaling_NaN        = false;
0069         static constexpr float_denorm_style                                   has_denorm               = denorm_present;
0070         static constexpr bool                                                 has_denorm_loss          = false;
0071         static                 boost::math::cstdfloat::detail::float_internal128_t  infinity     ()          { return BOOST_FLOAT128_C(1.0) / BOOST_FLOAT128_C(0.0); }
0072         static                 boost::math::cstdfloat::detail::float_internal128_t  quiet_NaN    ()          { return -(::BOOST_CSTDFLOAT_FLOAT128_SQRT(BOOST_FLOAT128_C(-1.0))); }
0073         static                 boost::math::cstdfloat::detail::float_internal128_t  signaling_NaN()          { return BOOST_FLOAT128_C(0.0); }
0074         static                 boost::math::cstdfloat::detail::float_internal128_t  denorm_min   ()          { return BOOST_CSTDFLOAT_FLOAT128_DENORM_MIN; }
0075         static constexpr bool                                                 is_iec559                = true;
0076         static constexpr bool                                                 is_bounded               = true;
0077         static constexpr bool                                                 is_modulo                = false;
0078         static constexpr bool                                                 traps                    = false;
0079         static constexpr bool                                                 tinyness_before          = false;
0080         static constexpr float_round_style                                    round_style              = round_to_nearest;
0081       };
0082     } // namespace std
0083 
0084   #endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)
0085 
0086 #endif // BOOST_MATH_CSTDFLOAT_LIMITS_2014_01_09_HPP_
0087