26#include "interval.hpp"
61 cxscthrow(ERROR_INTERVAL_EMPTY_INTERVAL(
"interval::interval(const dotprecision &,const dotprecision &)"));
67 inf=rnd(dot,RND_DOWN);
69 sup = rnd(dot,RND_UP);
71 cxscthrow(ERROR_INTERVAL_EMPTY_INTERVAL(
"interval::interval(const l_real &,const l_real &)"));
109 return(a>=b.inf && a<=b.sup);
113 return(a<=b.inf && a>=b.sup);
117 return(a>b.inf && a<b.sup);
122 return(a.inf>=b && a.sup<=b);
126 return(a.inf<=b && a.sup>=b);
130 return(a.inf<b && a.sup>b);
137std::ostream & operator << (std::ostream &s,
const interval& a)
noexcept
139 s <<
'[' << SaveOpt << RndDown
140 << a.inf <<
',' << RndUp
141 << a.sup << RestoreOpt
145std::string & operator << (std::string &s,
const interval &a)
noexcept
148 s << SaveOpt << RndDown
152 << a.sup << RestoreOpt;
157std::istream & operator >> (std::istream &s,
interval &a)
noexcept
161 skipeolnflag = inpdotflag =
true;
162 c = skipwhitespacessinglechar (s,
'[');
166 s >> SaveOpt >> RndDown >> a.inf;
168 skipeolnflag = inpdotflag =
true;
169 c = skipwhitespacessinglechar (s,
',');
170 if (inpdotflag) s.putback(c);
172 s >> RndUp >> a.sup >> RestoreOpt;
176 skipeolnflag =
false, inpdotflag =
true;
177 c = skipwhitespaces (s);
178 if (inpdotflag && c !=
']')
188std::string & operator >> (std::string &s,
interval &a)
noexcept
190 s = skipwhitespacessinglechar (s,
'[');
191 s >> SaveOpt >> RndDown >> a.inf;
192 s = skipwhitespacessinglechar (s,
',');
193 s >> RndUp >> a.sup >> RestoreOpt;
194 s = skipwhitespaces (s);
205void operator >>(
const std::string &s,
interval &a)
noexcept
210void operator >>(
const char *s,
interval &a)
noexcept
224 Dotprecision ptr = *dot.ptr();
229 ptr[(a_intg)++ptr[A_END]] = ZERO;
231 b_shr1 (&ptr[(a_intg)ptr[A_BEGIN]], (a_intg)(ptr[A_END]-ptr[A_BEGIN]+1));
233 if (ptr[(a_intg)ptr[A_END]] == ZERO)
236 if (ptr[(a_intg)ptr[A_BEGIN]] == ZERO)
247 {
return ( (Inf(y) <= x) && (x <= Sup(y)) ); }
251 return ( (Inf(y) < Inf(x)) && (Sup(x) < Sup(y)) );
284 tmp = (1.0+eps)*x - eps*x;
285 return interval(pred(Inf(tmp)),succ(Sup(tmp)));
290 return (Inf(a) > Sup(b)) || (Inf(b) > Sup(a));
297 else if (Inf(x) > 0.0)
341 for (i = 1; i <= n; i++) Infimum = succ(Infimum);
342 return (Infimum >= Sup(x));
347 const real Pi_Inf = 7074237752028440.0 / 2251799813685248.0;
350 const real Pi2_Inf = 7074237752028440.0 / 1125899906842624.0;
353 const real Pi3_Inf = 5305678314021330.0 / 562949953421312.0;
356 const real Pid2_Inf = 7074237752028440.0 / 4503599627370496.0;
359 const real Pid3_Inf = 4716158501352293.0 / 4503599627370496.0;
362 const real Pid4_Inf = 7074237752028440.0 / 9007199254740992.0;
365 const real Pir_Inf = 5734161139222658.0 / 18014398509481984.0;
368 const real Pi2r_Inf = 5734161139222658.0 / 36028797018963968.0;
372 const real Pip2_Inf = 5556093337880030.0 / 562949953421312.0;
375 const real SqrtPi_Inf = 7982422502469482.0 / 4503599627370496.0;
379 const real Sqrt2Pi_Inf = 5644425081792261.0 / 2251799813685248.0;
383 const real SqrtPir_Inf = 5081767996463981.0 / 9007199254740992.0;
387 const real Sqrt2Pir_Inf = 7186705221432912.0 / 18014398509481984.0;
391 const real Sqrt2_Inf = 6369051672525772.0 / 4503599627370496.0;
395 const real Sqrt5_Inf = 5035177455121575.0 / 2251799813685248.0;
399 const real Sqrt7_Inf = 5957702309312745.0 / 2251799813685248.0;
403 const real Sqrt2r_Inf = 6369051672525772.0 / 9007199254740992.0;
407 const real Sqrt3_Inf = 7800463371553962.0 / 4503599627370496.0;
411 const real Sqrt3d2_Inf = 7800463371553962.0 / 9007199254740992.0;
415 const real Sqrt3r_Inf = 5200308914369308.0 / 9007199254740992.0;
419 const real Ln2_Inf = 6243314768165359.0 / 9007199254740992.0;
422 const real Ln2r_Inf = 6497320848556798.0 / 4503599627370496.0;
425 const real Ln10_Inf = 5184960683398421.0 / 2251799813685248.0;
428 const real Ln10r_Inf = 7823553867474190.0 / 18014398509481984.0;
432 const real LnPi_Inf = 5155405087351229.0 / 4503599627370496.0;
435 const real Ln2Pi_Inf = 8277062471433908.0 / 4503599627370496.0;
439 const real E_Inf = 6121026514868073.0 / 2251799813685248.0;
442 const real Er_Inf = 6627126856707895.0 / 18014398509481984.0;
445 const real Ep2_Inf = 8319337573440941.0 / 1125899906842624.0;
448 const real Ep2r_Inf = 4875967449235915.0 / 36028797018963968.0;
451 const real EpPi_Inf = 6513525919879993.0 / 281474976710656.0;
454 const real Ep2Pi_Inf = 4710234414611993.0 / 8796093022208.0;
458 const real EpPid2_Inf = 5416116035097439.0 / 1125899906842624.0;
462 const real EpPid4_Inf = 4938827609611434.0 / 2251799813685248.0;
The Data Type dotprecision.
The Data Type idotprecision.
The Scalar Type interval.
interval & operator=(const real &a)
Implementation of standard assigning operator.
interval()
Constructor of class interval.
The Multiple-Precision Data Type l_real.
The namespace cxsc, providing all functionality of the class library C-XSC.
const interval Sqrt2Pi_interval
Enclosure-Interval for .
const interval EpPi_interval
Enclosure-Interval for .
const interval Sqrt5_interval
Enclosure-Interval for .
const interval Er_interval
Enclosure-Interval for .
const interval Sqrt3d2_interval
Enclosure-Interval for .
const interval Pid4_interval
Enclosure-Interval for .
const interval Pi2r_interval
Enclosure-Interval for .
const interval Sqrt2_interval
Enclosure-Interval for .
const interval Ln2Pi_interval
Enclosure-Interval for .
const interval Sqrt3r_interval
Enclosure-Interval for .
const interval Ln2r_interval
Enclosure-Interval for .
const interval EpPid4_interval
Enclosure-Interval for .
int Disjoint(const interval &a, const interval &b)
Checks arguments for disjointness.
const interval E_interval
Enclosure-Interval for .
const interval LnPi_interval
Enclosure-Interval for .
const interval Pid2_interval
Enclosure-Interval for .
cvector diam(const cimatrix_subv &mv) noexcept
Returns the diameter of the matrix.
int UlpAcc(const interval &x, int n)
Checks if the diameter of the interval is ulps.
const interval Ep2_interval
Enclosure-Interval for .
real RelDiam(const interval &x)
Computes the relative diameter .
const interval Sqrt7_interval
Enclosure-Interval for .
int in(const cinterval &x, const cinterval &y)
Checks if first argument is part of second argument.
const interval Pir_interval
Enclosure-Interval for .
const interval Pip2_interval
Enclosure-Interval for .
const interval Ln2_interval
Enclosure-Interval for .
const interval Pid3_interval
Enclosure-Interval for .
const interval SqrtPir_interval
Enclosure-Interval for .
const interval Sqrt2r_interval
Enclosure-Interval for .
const interval Pi2_interval
Enclosure-Interval for .
const interval Ep2Pi_interval
Enclosure-Interval for .
const interval Ln10_interval
Enclosure-Interval for .
const interval Ep2r_interval
Enclosure-Interval for .
real AbsMax(const interval &x)
Computes the greatest absolute value .
const interval Ln10r_interval
Enclosure-Interval for .
ivector abs(const cimatrix_subv &mv) noexcept
Returns the absolute value of the matrix.
cvector mid(const cimatrix_subv &mv) noexcept
Returns the middle of the matrix.
const interval EpPid2_interval
Enclosure-Interval for .
const interval Sqrt3_interval
Enclosure-Interval for .
const interval Sqrt2Pir_interval
Enclosure-Interval for .
const interval Pi3_interval
Enclosure-Interval for .
const interval SqrtPi_interval
Enclosure-Interval for .
cinterval Blow(cinterval x, const real &eps)
Performs an epsilon inflation.
const interval Pi_interval
Enclosure-Interval for .
real AbsMin(const interval &x)
Computes the smallest absolute value .