[ kepler | Source | Keywords | Summary | Ancestors | All Members | Descendants ]
Back to the top of interval
Additional procedures for manipulating intervals are found in the interMath class.
An introduction to interval arithmetic
It is unworthy of excellent persons to lose hours like slaves in the labor of calculation.
. . . Gottfried Wilhelm von Leibniz
Back to the Kepler conjecture home page.
Back to the top of interval
Back to the top of interval
interval(const char *);
A standard constructor for intervals.
Intervals are general initialized by strings rather than
as decimal constants. The rounding mode is set appropriately
when the string is converted to an interval, so that an interval
bracketing the decimal conversion of the string is obtained.
We use strings because of untrustworthy things that compilers do with doubles. For example, on my Sun CC and SGI CC compilers even if the rounding mode is set upward interMath::up(), we get assert(1.0 == 1.0+DBL_MIN) even though DBL_MIN is positive. Similarly, although claiming to be IEEE compliant, programs give assert(1.0 == 1.00000000000000000001) even when the rounding mode is directed upward. It seems that constants are computed at compile time, but rounding modes are set at run time, so to get a reliable constant, we must wrap constants in a string until run time.
interval(const char *); // construct with a string; interval("3.14"), etc.
Back to the top of interval
interval wideInterval(const char *,const char *);
Another constructor for intervals
The first string is converted using downward rounding to the
lower bound of the interval. The second string is rounding
up to a representable number giving the upper bound of the interval.
static interval wideInterval(const char *,const char *); // lo, hi
Back to the top of interval
interval(double,double);
Construct an interval from the endpoints. Refer to the comments
for the string constructor to see the shortfalls of a double
type constructor. This constructor should only be used on
doubles that are computed at run time using interval
arithmetic.
inline interval(double,double); // lo, hi
Function is currently defined inline.
Back to the top of interval
interval() ;
This constructor does nothing
interval() ;
Function is currently defined inline.
Back to the top of interval
interval operator+(interval) const;
Addition of intervals is based on IEEE rounding modes so that
the interval returned contains the sum of the two intervals.
inline interval operator+(interval) const;
Function is currently defined inline.
Back to the top of interval
interval operator-(interval) const;
Subtraction of intervals is based on IEEE rounding modes so that
the interval returned contains the difference of the two intervals.
inline interval operator-(interval) const;
Function is currently defined inline.
Back to the top of interval
interval operator*(interval) const;
Multiplication of intervals is based on IEEE rounding modes so that
the interval returned contains the product of the two intervals.
Multiplication is performed inline if both intervals are
completely positive. Otherwise, a long procedure with many
cases is called
inline interval operator*(interval) const;
Function is currently defined inline.
Back to the top of interval
interval operator/(interval) const;
Division of intervals is based on IEEE rounding modes. In the
current implementation x/y is computed as x times the reciprocal
of y. If the interval y contains zero, an error message is
issued and zero is returned.
An extremely paranoid view is taken of division by zero. If
the interval comes within float.h's DBL_EPSILON of zero, then
it is considered an error. The user might want to change
the constant to something less paranoid, such as DBL_MIN.
inline interval operator/(interval) const;
Function is currently defined inline.
Back to the top of interval
interval operator-() const;
Unary negation of intervals. This operation should be independent
of the rounding mode.
inline interval operator-() const;
Function is currently defined inline.
Back to the top of interval
int operator<(interval) const;
Is completely less than. This relation is true only if
every element of the first interval is strictly less than
every element of the second.
inline int operator<(interval) const; // completely less than
Function is currently defined inline.
Back to the top of interval
int operator>(interval) const;
Is completely greater than. This relation is true only if
every element of the first interval is strictly greater than
every element fo the second.
inline int operator>(interval) const; // completely greater than
Function is currently defined inline.
Back to the top of interval
int operator==(interval) const;
Is identically equal to. This relation between intervals
is true if both endpoints are equal.
inline int operator==(interval) const; // identically =
Function is currently defined inline.
Back to the top of interval
Back to the top of interval
Back to the top of interval
Back to the top of interval
Report problems to jkotula@unimax.com