24 #ifndef PPL_checked_numeric_limits_hh
25 #define PPL_checked_numeric_limits_hh 1
35 #define PPL_SPECIALIZE_LIMITS_INT(T) \
37 template <typename Policy> \
38 class numeric_limits<Checked_Number<PPL_U(T), Policy> > \
39 : public numeric_limits<PPL_U(T)> { \
41 typedef Checked_Number<PPL_U(T), Policy> Type; \
44 static const bool has_infinity = Policy::has_infinity; \
45 static const bool has_quiet_NaN = Policy::has_nan; \
49 v.raw_value() = Checked::Extended_Int<Policy, PPL_U(T)>::min; \
55 v.raw_value() = Checked::Extended_Int<Policy, PPL_U(T)>::max; \
59 static Type infinity() { \
61 Checked::assign_special<Policy>(v.raw_value(), VC_PLUS_INFINITY, \
66 static Type quiet_NaN() { \
68 Checked::assign_special<Policy>(v.raw_value(), VC_NAN, \
88 #undef PPL_SPECIALIZE_LIMITS_INT
90 #define PPL_SPECIALIZE_LIMITS_FLOAT(T) \
92 template <typename Policy> \
93 struct numeric_limits<Checked_Number<PPL_U(T), Policy> > \
94 : public numeric_limits<PPL_U(T)> { \
97 #if PPL_SUPPORTED_FLOAT
100 #if PPL_SUPPORTED_DOUBLE
103 #if PPL_SUPPORTED_LONG_DOUBLE
107 #undef PPL_SPECIALIZE_LIMITS_FLOAT
109 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
110 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
112 template <
typename Policy>
114 numeric_limits<Checked_Number<mpz_class, Policy> >
120 static const bool has_infinity = Policy::has_infinity;
121 static const bool has_quiet_NaN = Policy::has_nan;
137 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
138 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
140 template <
typename Policy>
142 numeric_limits<Checked_Number<mpq_class, Policy> >
148 static const bool has_infinity = Policy::has_infinity;
149 static const bool has_quiet_NaN = Policy::has_nan;
167 #endif // !defined(PPL_checked_numeric_limits_hh)
#define PPL_SPECIALIZE_LIMITS_INT(T)
The standard C++ namespace.
Not a number result class.
Specialization of std::numeric_limits.
A wrapper for numeric types implementing a given policy.
Positive infinity result class.
Checked_Number< mpq_class, Policy > Type
Checked_Number< mpz_class, Policy > Type
#define PPL_SPECIALIZE_LIMITS_FLOAT(T)
The entire library is confined to this namespace.
Specialization of std::numeric_limits.
T & raw_value()
Returns a reference to the underlying numeric value.