24 #ifndef PPL_intervals_defs_hh
25 #define PPL_intervals_defs_hh 1
28 #include "assertions.hh"
33 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
36 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
38 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
39 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
42 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
43 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
46 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
50 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
52 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
53 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
56 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
57 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
60 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
61 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
64 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
65 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
68 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
69 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
72 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
73 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
76 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
77 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
80 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
81 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
84 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
85 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
88 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
89 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
96 return static_cast<I_Result>(
static_cast<unsigned>(a)
97 | static_cast<unsigned>(b));
102 return static_cast<I_Result>(
static_cast<unsigned>(a)
103 & static_cast<unsigned>(b));
108 return static_cast<I_Result>(
static_cast<unsigned>(a)
109 & ~static_cast<unsigned>(b));
112 template <
typename Criteria,
typename T>
115 struct Use_Slow_Copy;
116 template <
typename T>
118 :
public Bool<Slow_Copy<T>::value> {
122 template <
typename T>
128 template <
typename T>
133 template <
typename T,
typename Criteria = Use_Slow_Copy,
typename Enable =
void>
136 template <
typename T,
typename Criteria>
153 void set(Arg_Type v,
bool =
false) {
156 Return_Type
get()
const {
159 operator Return_Type()
const {
164 template <
typename T,
typename Criteria>
187 void set(
const T& v,
bool) {
190 Return_Type
get()
const {
193 operator Return_Type()
const {
201 template <
typename Derived>
204 template <
typename T>
206 const Derived&
c =
static_cast<const Derived&
>(*this);
285 template <
typename T>
287 const Derived&
c =
static_cast<const Derived&
>(*this);
289 if (c.rel() !=
V_EQ) {
307 PPL_ASSERT(rel2 ==
V_LE);
314 if (rel2 ==
V_LE && to1 == to2) {
337 template <
typename T>
349 rel = floor_assign_r(to, to,
ROUND_UP);
351 PPL_ASSERT(rel ==
V_EQ);
363 PPL_ASSERT(rel ==
V_EQ);
388 : rel(static_cast<
Result>(r)) {
395 template <
typename T,
typename Val_Or_Ref_Criteria = Use_Slow_Copy,
396 bool extended =
false>
411 : rel_(r), value_(v) {
414 : rel_(r), value_(v, force) {
416 template <
typename U>
418 : rel_(r), value_(v) {
426 value_.set(v, force);
428 template <
typename U>
441 template <
typename T>
442 inline I_Constraint<T>
447 template <
typename T>
448 inline I_Constraint<T>
453 template <
typename T>
454 inline I_Constraint<T>
459 template <
typename T,
typename Val_Or_Ref_Criteria>
460 inline I_Constraint<T, Val_Or_Ref_Criteria>
465 template <
typename T,
typename Val_Or_Ref_Criteria>
466 inline I_Constraint<T, Val_Or_Ref_Criteria>
468 const Val_Or_Ref_Criteria&) {
472 template <
typename T,
typename Val_Or_Ref_Criteria>
473 inline I_Constraint<T, Val_Or_Ref_Criteria>
480 #endif // !defined(PPL_intervals_defs_hh)
Result may be empty or not empty.
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type assign_r(To &to, const From &, Rounding_Dir dir)
I_Constraint< T > i_constraint(I_Constraint_Rel rel, const T &v)
Result is definitely inexact.
The computed result is exact.
Result is neither empty nor the domain universe.
I_Result
The result of an operation on intervals.
Val_Or_Ref< T, Val_Or_Ref_Criteria > Val_Ref
Result convert_real(T &to1, Result &rel2, T &to2) const
void set(I_Constraint_Rel r, const T &v, bool force)
I_Constraint_Rel(Result r)
A positive integer overflow occurred (rounding up).
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Result may be empty or not empty.
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_integer(const T &x)
Result
Possible outcomes of a checked arithmetic computation.
Result may have only one value.
Val_Or_Ref & operator=(Arg_Type v)
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Operation is undefined for some combination of values.
Result may be the domain universe.
The computed result is inexact and rounded down.
Val_Or_Ref(const T &v, bool)
The exact result is not comparable.
I_Result operator&(I_Result a, I_Result b)
Result may have more than one value, but it is not the domain universe.
Relation_Symbol
Relation symbols.
Negative infinity result.
A class holding a constant called value that evaluates to true.
I_Result operator|(I_Result a, I_Result b)
bool eq(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
The computed result is inexact.
Result result_relation_class(Result r)
Result is definitely exact.
The computed result may be inexact and rounded up.
I_Constraint(I_Constraint_Rel r, const T &v, bool force)
Val_Ref::Arg_Type Arg_Type
void set(const T &v, bool)
The entire library is confined to this namespace.
Result convert_real(T &to) const
I_Constraint_Rel(Relation_Symbol r)
void set(I_Constraint_Rel r, const U &v)
Operation has definitely changed the set.
The computed result may be inexact and rounded down.
I_Constraint(I_Constraint_Rel r, const U &v)
Result convert_integer(T &to) const
I_Constraint(I_Constraint_Rel r, Arg_Type v)
void set(Arg_Type v, bool=false)
Positive infinity result.
Val_Or_Ref(Arg_Type v, bool=false)
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator-(const Interval< B, Info > &x, const T &y)
A negative integer overflow occurred (rounding down).
The computed result is inexact and rounded up.
A class that provides a type member called type equivalent to T if and only if b is true...
Operation has left the set definitely unchanged.
The computed result may be inexact.
Return_Type value() const
A class holding a constant called value that evaluates to false.
void set(I_Constraint_Rel r, Arg_Type v)
Val_Or_Ref & operator=(Arg_Type v)
Val_Ref::Return_Type Return_Type
A class holding a constant called value that evaluates to b.