34 cxscthrow(ERROR_INTERVAL_EMPTY_INTERVAL(
"inline interval::interval(const real &a,const real &b)"));
92 return interval((a.inf<b.inf)?a.inf:b.inf,(a.sup>b.sup)?a.sup:b.sup);
96 return interval((a.inf>b.inf)?a.inf:b.inf,(a.sup<b.sup)?a.sup:b.sup);
100 return interval((a<b.inf)?a:b.inf,(a>b.sup)?a:b.sup);
104 return interval((a>b.inf)?a:b.inf,(a<b.sup)?a:b.sup);
108 return interval((a.inf<b)?a.inf:b,(a.sup>b)?a.sup:b);
117 return interval((a.inf>b)?a.inf:b,(a.sup<b)?a.sup:b);
121 a.inf=(a.inf<b.inf)?a.inf:b.inf,a.sup=(a.sup>b.sup)?a.sup:b.sup;
126 a.inf=(a.inf>b.inf)?a.inf:b.inf,a.sup=(a.sup<b.sup)?a.sup:b.sup;
128 cxscthrow(ERROR_INTERVAL_EMPTY_INTERVAL(
"inline interval & operator &=(interval &a,const interval &b)"));
133 a.inf=(a.inf<b)?a.inf:b,a.sup=(a.sup>b)?a.sup:b;
138 a.inf=(a.inf>b)?a.inf:b,a.sup=(a.sup<b)?a.sup:b;
140 cxscthrow(ERROR_INTERVAL_EMPTY_INTERVAL(
"inline interval & operator &=(interval &a,const real &b)"));
171 return(a.inf>=b.inf && a.sup<=b.sup);
175 return(a.inf<=b.inf && a.sup>=b.sup);
179 return(a.inf>b.inf && a.sup<b.sup);
183 return(a.inf<b.inf && a.sup>b.sup);
188 return(a>=b.inf && a<=b.sup);
192 return(a<=b.inf && a>=b.sup);
196 return(a>b.inf && a<b.sup);
201 return(a.inf>=b && a.sup<=b);
205 return(a.inf<=b && a.sup>=b);
209 return(a.inf<b && a.sup>b);
233 return interval(0.0, (h1 > h2) ? h1 : h2);
242 return subup(a.sup,a.inf);
247 return addd( a.inf, subd(0.5*a.sup,0.5*a.inf) );
254 r1 = x.inf; r2 = x.sup;
256 if (j >= -1021) r1 = comp(mant(r1),j);
260 r1 = comp(mant(r1), -1021);
263 if (sign(r1)>=0) r1 = 0;
266 r1 = muld(r1,comp(0.5,j+1));
269 if (j >= -1021) r2 = comp(mant(r2),j);
273 r2 = comp(mant(r2), -1021);
278 }
else r2 = mulu(r2,comp(0.5,j+1));
284 {
return interval (adddown(a.inf,b.inf),addup(a.sup,b.sup)); }
286 {
return interval (adddown(a.inf,b),addup(a.sup,b)); }
288 {
return interval (adddown(a,b.inf),addup(a,b.sup)); }
291 {
return interval ( subdown(a.inf,b.sup), subup(a.sup,b.inf)); }
293 {
return interval ( subdown(a.inf,b), subup(a.sup,b)); }
295 {
return interval ( subdown(a,b.sup), subup(a,b.inf)); }
315 if (sign(a.inf) >= 0)
317 if (sign(b.inf) >= 0)
319 tmp.inf = multdown(a.inf,b.inf);
320 tmp.sup = multup(a.sup,b.sup);
321 }
else if (sign(b.sup) >= 0)
323 tmp.inf = multdown(a.sup,b.inf);
324 tmp.sup = multup(a.sup,b.sup);
327 tmp.inf = multdown(a.sup,b.inf);
328 tmp.sup = multup(a.inf,b.sup);
330 }
else if (sign(a.sup) >= 0)
332 if (sign(b.inf) >= 0)
334 tmp.inf = multdown(a.inf,b.sup);
335 tmp.sup = multup(a.sup,b.sup);
336 }
else if (sign(b.sup) >= 0)
340 tmp.inf = multdown(a.inf,b.sup);
341 hlp = multdown(a.sup,b.inf);
346 tmp.sup = multup(a.inf,b.inf);
347 hlp = multup(a.sup,b.sup);
353 tmp.inf = multdown(a.sup,b.inf);
354 tmp.sup = multup(a.inf,b.inf);
358 if (sign(b.inf) >= 0)
360 tmp.inf = multdown(a.inf,b.sup);
361 tmp.sup = multup(a.sup,b.inf);
362 }
else if (sign(b.sup) >= 0)
364 tmp.inf = multdown(a.inf,b.sup);
365 tmp.sup = multup(a.inf,b.inf);
368 tmp.inf = multdown(a.sup,b.sup);
369 tmp.sup = multup(a.inf,b.inf);
391 if ((sign(b.inf) <= 0) && (sign(b.sup) >= 0))
392 cxscthrow(DIV_BY_ZERO(
"interval::interval operator/(const interval&,const interval&)"));
394 if (sign(a.inf) >= 0)
398 tmp.inf = divdown(a.inf,b.sup);
399 tmp.sup = divup(a.sup,b.inf);
402 tmp.inf = divdown(a.sup,b.sup);
403 tmp.sup = divup(a.inf,b.inf);
405 }
else if (sign(a.sup) >= 0)
409 tmp.inf = divdown(a.inf,b.inf);
410 tmp.sup = divup(a.sup,b.inf);
413 tmp.inf = divdown(a.sup,b.sup);
414 tmp.sup = divup(a.inf,b.sup);
420 tmp.inf = divdown(a.inf,b.inf);
421 tmp.sup = divup(a.sup,b.sup);
424 tmp.inf = divdown(a.sup,b.inf);
425 tmp.sup = divup(a.inf,b.sup);
439 }
else if (sign(a) > 0)
441 tmp.inf = multdown(a,b.inf);
442 tmp.sup = multup(a,b.sup);
445 tmp.inf = multdown(a,b.sup);
446 tmp.sup = multup(a,b.inf);
458 }
else if (sign(b) > 0)
460 tmp.inf = multdown(a.inf,b);
461 tmp.sup = multup(a.sup,b);
464 tmp.inf = multdown(a.sup,b);
465 tmp.sup = multup(a.inf,b);
friend bool operator>=(const interval &, const interval &)
Implementation of standard greater-or-equal-than operation.
friend bool operator<(const interval &, const interval &)
Implementation of standard less-than operation.
The namespace cxsc, providing all functionality of the class library C-XSC.
friend interval & operator/=(interval &, const interval &)
Implementation of standard algebraic division and allocation operation.
The Scalar Type interval.
friend bool operator==(const interval &, const interval &)
Implementation of standard equality operation.
friend interval & operator-=(interval &, const interval &)
Implementation of standard algebraic subtraction and allocation operation.
friend interval & operator*=(interval &, const interval &)
Implementation of standard algebraic multiplication and allocation operation.
friend real & Inf(interval &)
Returns the infimum of an interval.
friend interval & UncheckedSetInf(interval &, const real &)
Returns the interval with the unchecked new given infimum value.
friend interval _unchecked_interval(const real &, const real &)
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC...
friend interval operator&(const interval &, const interval &)
Returns the intersection of the arguments.
friend interval & operator+=(interval &, const interval &)
Implementation of standard algebraic addition and allocation operation.
friend interval abs(const interval &)
Returns the absolute value of the interval.
friend bool operator>(const interval &, const interval &)
Implementation of standard greater-than operation.
friend void times2pown(interval &, const int &)
Multiplication of interval with .
friend interval operator/(const interval &, const interval &)
Implementation of standard algebraic division operation.
friend interval operator*(const interval &, const interval &)
Implementation of standard algebraic multiplication operation.
friend interval operator|(const interval &, const interval &)
Returns the convex hull of the arguments.
friend bool IsEmpty(const interval &)
Returns true if the interval is empty.
interval()
Constructor of class interval.
interval & operator=(const real &a)
Implementation of standard assigning operator.
friend bool operator<=(const interval &, const interval &)
Implementation of standard less-or-equal-than operation.
friend real & Sup(interval &)
Returns the supremum of an interval.
friend interval operator-(const interval &)
Implementation of standard algebraic negative sign operation.
friend interval & SetInf(interval &, const real &)
Returns the interval with the new given infimum value.
const real minreal
Smallest positive denormalized representable floating-point number.
friend interval & UncheckedSetSup(interval &, const real &)
Returns the interval with the unchecked new given supremum value.
friend interval & operator&=(interval &, const interval &)
Allocates the intersection of the arguments to the first argument.
friend bool operator!(const interval &)
Implementation of standard negation operation.
friend interval operator+(const interval &)
Implementation of standard algebraic positive sign operation.
friend interval & operator|=(interval &, const interval &)
Allocates the convex hull of the arguments to the first argument.
friend real diam(const interval &)
Returns the rounded diameter of the interval.
friend interval _interval(const ivector &)
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC...
friend interval & SetSup(interval &, const real &)
Returns the interval with the new given supremum value.
friend bool operator!=(const interval &, const interval &)
Implementation of standard negated equality operation.