Re: Definition of intervals as subsets of R - the bad news
Siegfried M. Rump wrote :
In a nutshell, defining interval to consist only of finite
numbers is a nice concept, but various exceptional operations
such as 0*inf or inf-inf have to be identified and redefined.
For example, this slows down addition by about a factor 2.
I am afraid, a penalty might also apply to a C- or Fortran
implementation.
Dear Siegfried,
What we ended up doing in the draft proposal for C++ was to invoke
"undefined behavior" in such situations (e.g. when constructing
an interval from a non-finite value). "Undefined behavior" is
defined in the C++ standard and means "anything can happen".
In particular, this allows to have the following two sensible
behaviors:
- raise an error in any way is prefered
- remove all checks completely, assuming everything is OK,
hence getting optimal speed.
In practice, what can be done is to have 2 "modes" of an implementation,
one including checks, and the other with the checks removed.
Both are then conformant to the standard specifications.
It is quite common to do that, for example, the standard library
shipped with GCC has a "debug" mode offering many such additional
checks, and this mode can be selected by specifying a macro on
the command line (the default is the fast mode).
Other compiled languages (e.g. C, Fortran) can probably easily
provide something similar.
I'm not familiar enough with Matlab, but maybe something similar
could be envisioned ?
--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/