File indexing completed on 2025-01-18 09:42:21
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_MP_DETAIL_FLOAT128_FUNCTIONS_HPP
0010 #define BOOST_MP_DETAIL_FLOAT128_FUNCTIONS_HPP
0011
0012 #include <boost/multiprecision/detail/standalone_config.hpp>
0013
0014 #ifndef BOOST_MP_STANDALONE
0015 #include <boost/cstdfloat.hpp>
0016 #if defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT)
0017 # define BOOST_MP_HAVE_CSTDFLOAT
0018 #endif
0019 #endif
0020
0021 #if defined(BOOST_HAS_FLOAT128)
0022
0023 namespace boost
0024 {
0025 namespace multiprecision
0026 {
0027 namespace float128_procs
0028 {
0029 extern "C" __float128 ldexpq(__float128, int) throw();
0030 extern "C" __float128 frexpq(__float128, int*) throw();
0031 extern "C" __float128 floorq(__float128) throw();
0032 extern "C" __float128 nextafterq(__float128, __float128) throw();
0033 extern "C" int isinfq(__float128) throw();
0034 extern "C" int isnanq(__float128) throw();
0035 extern "C" __float128 strtoflt128(const char*, char**) throw();
0036
0037 #ifdef BOOST_MP_HAVE_CSTDFLOAT
0038 using std::ldexp;
0039 using std::frexp;
0040 using std::floor;
0041 using std::nextafter;
0042 #else
0043 inline __float128 ldexp(__float128 f, int i) throw() { return ldexpq(f, i); }
0044 inline __float128 frexp(__float128 f, int* p) throw() { return frexpq(f, p); }
0045 inline __float128 floor(__float128 f) throw() { return floorq(f); }
0046 inline __float128 nextafter(__float128 a, __float128 b) throw() { return nextafterq(a, b); }
0047 #endif
0048 }
0049
0050 namespace detail {
0051
0052 template <class T>
0053 struct is_float128 : public std::is_same<__float128, T>
0054 {};
0055
0056 }
0057 }
0058 }
0059
0060 namespace boost {
0061 namespace math {
0062
0063 inline __float128 float_next(const __float128& f)
0064 {
0065 return boost::multiprecision::float128_procs::nextafterq(f, 2 * f);
0066 }
0067 inline int (isinf)(const __float128& f)
0068 {
0069 return boost::multiprecision::float128_procs::isinfq(f);
0070 }
0071 inline int (isnan)(const __float128& f)
0072 {
0073 return boost::multiprecision::float128_procs::isnanq(f);
0074 }
0075
0076 }}
0077
0078 #define BOOST_MP_FLOAT128_USING using boost::multiprecision::float128_procs::ldexp; using boost::multiprecision::float128_procs::frexp; using boost::multiprecision::float128_procs::floor; using boost::multiprecision::float128_procs::nextafter; using boost::math::isinf; using boost::math::isnan;
0079
0080 #else
0081 #define BOOST_MP_FLOAT128_USING
0082
0083 namespace boost {
0084 namespace multiprecision {
0085 namespace detail {
0086
0087 template <class T>
0088 struct is_float128 : public std::false_type
0089 {};
0090
0091 }}}
0092
0093 #endif
0094
0095 #endif