interval Programmers Guide Contents | Index |  Search

Category:intervals,containers Component type:type
Description
A number type which implements interval arithmetic. Evaluation of an operation performed on an interval will calculate the upper and lower bounds of a set of numbers. Within this set one can be certain that the answer lies. Interval operations round an interval "outward" (rounding the lower bound down and the upper bound up) to ensure that the exact answer will be within the interval returned.

For example:
On a machine with very limited precision, If an interval A bounded by 2.0 and 3.0 were added to an interval B bounded by 1.0 and 2.0, the sum (after outward rounding) may be an interval bounded by 3.01 and 5.01.
Or, in code:

``` interval A(2.0,3.0), B(1.0,2.0); cout << A+B;```

``` ``` may return `[3.01,5.01]`.
When output to a character stream, intervals are expressed in the form `[x,y]` where `x` is the lower (or left) bound and `y` is the upper (right) bound.

Example
In construct.cc:
```  interval<double> normal(1,2);
interval<double> single(1);
interval<double> exact(1,2,true);
interval<double> copy_interval(normal);

```
Definition
interval.h
Template Parameters
Model of
Members
Member Where defined Description
value_type
interval (const Tnum& le, const Tnum& ri,bool exact)   Exact constructor (no outward rounding)
interval (const Tnum& le, const Tnum& ri)   Normal constructur
interval (const Tnum& x = Tnum())   Default constructor/ Single Tnum constructor
interval (const self&)
template <class X>
interval (const interval<X>&)

const Tnum& left () const   Constant accessor for the lower bound of an interval
const Tnum& right () const   Constant accessor for the upper bound of an interval
Tnum& left (void)   Accessor for the lower bound of an interval
Tnum& right (void)   Accessor for the upper bound of an interval
const Tnum& inf () const   Alternate constant accessor for the lower bound of an interval
const Tnum& sup () const   Alternate constant accessor for the upper bound of an interval
Tnum& inf (void)   Alternate accessor for the lower bound of an interval
Tnum& sup (void)   Alternate accessor for the upper bound of an interval
self& operator= (const Tnum&)
self& operator+= (const Tnum&)
self& operator-= (const Tnum&)
self& operator*= (const Tnum&)
self& operator/= (const Tnum&)
self& operator= (const self& x)
template <class X>
interval<X>& operator= (const interval<X>& x)

template <class X>
interval<X>& operator+= (const interval<X>& x)

template <class X>
interval<X>& operator-= (const interval<X>& x)

template <class X>
interval<X>& operator*= (const interval<X>& x)

template <class X>
interval<X>& operator/= (const interval<X>& x)

self& operator ()
self operator (int)
self& operator-- ()
self operator-- (int)
static void rounddown ()   sets the floating point rounding mode to round up
static void roundup ()   sets the floating point rounding mode to round down
static void roundnear ()   sets rounding to nearest mode
static self pi2 ()   Returns an interval of the number pi*2, properly rounded outward.
static self pi ()   Returns an interval of pi, properly rounded outward.
static self piby2 ()   Returns an interval of the number (1/2)*pi, properly rounded outward.
static self pi3by2 ()   Returns an interval of the number (3/2)*pi, properly rounded outward.
static self pi5by2 ()   Returns an interval of the number (5/2)*pi, properly rounded outward.
static Tnum epsilon ()   Utility functions equivilant to numeric_limits functions
static Tnum eta ()
static Tnum pos_inf ()
static Tnum neg_inf ()
static Tnum Nan ()   Utility function to return a non-signaling NaN
static int rdval, ruval, rnval
New members
Notes