24 #ifndef PPL_Interval_templates_hh
25 #define PPL_Interval_templates_hh 1
31 template <
typename Boundary,
typename Info>
39 return lower_extend();
58 template <
typename Boundary,
typename Info>
66 return lower_extend();
85 template <
typename Boundary,
typename Info>
86 template <
typename From,
typename Iterator>
92 PPL_ASSERT(contains(y));
97 Boundary& x_ub = x.
upper();
98 const Boundary& y_ub = y.upper();
99 PPL_ASSERT(!y.upper_is_boundary_infinity() && y_ub <= x_ub);
101 Iterator k = std::lower_bound(first, last, x_ub);
115 Boundary& x_lb = x.
lower();
116 const Boundary& y_lb = y.lower();
117 PPL_ASSERT(!y.lower_is_boundary_infinity() && y_lb >= x_lb);
119 Iterator k = std::lower_bound(first, last, x_lb);
142 template <
typename Boundary,
typename Info>
145 Boundary lower_bound;
148 throw std::invalid_argument(
"PPL::Interval(const char* s)"
154 Boundary upper_bound;
160 bool lower_open =
false;
161 bool upper_open =
false;
162 bool lower_boundary_infinity =
false;
163 bool upper_boundary_infinity =
false;
175 lower_boundary_infinity =
true;
210 upper_boundary_infinity =
true;
217 if (!lower_boundary_infinity
218 && !upper_boundary_infinity
219 && (lower_bound > upper_bound
220 || (lower_open && lower_bound == upper_bound))) {
224 if (lower_boundary_infinity) {
231 if (upper_boundary_infinity) {
242 template <
typename Boundary,
typename Info>
245 Boundary lower_bound;
246 Boundary upper_bound;
247 bool lower_boundary_infinity =
false;
248 bool upper_boundary_infinity =
false;
249 bool lower_open =
false;
250 bool upper_open =
false;
280 goto unexpected_char;
297 goto unexpected_char;
301 upper_r = input(upper_bound, is,
ROUND_UP);
320 is.setstate(std::ios::failbit);
336 lower_boundary_infinity =
true;
371 upper_boundary_infinity =
true;
378 if (!lower_boundary_infinity
379 && !upper_boundary_infinity
380 && (lower_bound > upper_bound
381 || (lower_open && lower_bound == upper_bound))) {
385 if (lower_boundary_infinity) {
392 if (upper_boundary_infinity) {
403 template <
typename Boundary,
typename Info>
404 template <
typename From>
417 if (!upper_is_boundary_infinity() && !y.upper_is_boundary_infinity()
418 && y.upper() <= upper()) {
422 if (!lower_is_boundary_infinity() && !y.lower_is_boundary_infinity()
423 && y.lower() >= lower()) {
429 template <
typename Boundary,
typename Info>
430 template <
typename From>
439 #endif // !defined(PPL_Interval_templates_hh)
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type assign_r(To &to, const From &, Rounding_Dir dir)
The empty element, i.e., the empty set.
The computed result is exact.
I_Result
The result of an operation on intervals.
Result set_minus_infinity(Boundary_Type type, T &x, Info &info, bool open=false)
Result set_plus_infinity(Boundary_Type type, T &x, Info &info, bool open=false)
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.
const Boundary & f_upper(const Interval< Boundary, Info > &x)
Result
Possible outcomes of a checked arithmetic computation.
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
bool is_space(char c)
Returns true if c is any kind of space character.
std::istream & operator>>(std::istream &is, Interval< Boundary, Info > &x)
void max_assign(N &x, const N &y)
Assigns to x the maximum between x and y.
The computed result is inexact and rounded down.
Enable_If< Is_Interval< From >::value, bool >::type simplify_using_context_assign(const From &y)
Assigns to *this a meet-preserving simplification of *this with respect to y.
Result assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, bool should_shrink=false)
I_Result assign(Degenerate_Element e)
bool lower_is_boundary_infinity() const
Negative infinity result.
const Info & f_info(const Interval< Boundary, Info > &x)
Result result_relation_class(Result r)
Converting from unknown string.
const Scalar_As_Interval_Info SCALAR_INFO
Enable_If< Is_Interval< From >::value, void >::type CC76_widening_assign(const From &y, Iterator first, Iterator last)
Result is definitely exact.
The computed result may be inexact and rounded up.
The universe element, i.e., the whole vector space.
A generic, not necessarily closed, possibly restricted interval.
const Boundary & f_lower(const Interval< Boundary, Info > &x)
The entire library is confined to this namespace.
Enable_If< Is_Interval< From >::value, void >::type empty_intersection_assign(const From &y)
Assigns to *this an interval having empty intersection with y. The assigned interval should be as lar...
The computed result may be inexact and rounded down.
From bool Type Type Rounding_Dir From
Positive infinity result.
bool upper_is_boundary_infinity() const
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.
void min_assign(N &x, const N &y)
Assigns to x the minimum between x and y.