Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Comment on "undefined" behavior Re: Definition of intervals as subsets of R - the bad news



Everything else being equal, we should try to avoid
undefined behavior.  The goal of the standardization process
is to define the behavior so things are predictable.  We should
also try to avoid multiple alternatives, unless absolutely
necessary.

We haven't formally considered "infinity as a number" yet, although
we've discussed it extensively.  We can weigh the system, using
IEEE 754R and infinity as a number, and without exceptions, against
the perceived elegance mathematical of interpreting intervals to be composed only
of finite real numbers, but with associated inefficiencies or
weakening of the standard.  This would be a simple motion to formulate,
and we're probably ready to formally discuss it and vote.

Baker

On 2/19/2009 5:17 AM, Sylvain Pion wrote:
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 ?



--

---------------------------------------------------------------
R. Baker Kearfott,    rbk@xxxxxxxxxxxxx   (337) 482-5346 (fax)
(337) 482-5270 (work)                     (337) 993-1827 (home)
URL: http://interval.louisiana.edu/kearfott.html
Department of Mathematics, University of Louisiana at Lafayette
(Room 217 Maxim D. Doucet Hall, 1403 Johnston Street)
Box 4-1010, Lafayette, LA 70504-1010, USA
---------------------------------------------------------------