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

Re: Definition of intervals as subsets of R - the bad news



Gabriel Dos Reis a écrit :
On Thu, Feb 19, 2009 at 6:17 AM, Sylvain Pion
<Sylvain.Pion@xxxxxxxxxxxxxxx> 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".

That may be appropriate for the C++ standard document -- because,
among other things C++ is in general very loose about numerics
(there isn't even a notion of accuracy).  However, I'm highly skeptical
that "undefined behaviour" in general helps a standard specifically crafted
for scientific computations and reproducibility of results.

There are various options beside "undefined behavour".  If the
purprose is to leave something up to the implementation, I would
think "implemented defined behaviour" should be that.  It leaves
the choice to the implementation, but it does require the implementation
to document its choice.

"Undefined behaviour" is not something the C or the C++ community
is proud of (you probably remember efforts by some of us to reduce
the number of undefined behaviour.)   I find it suspicious that this
body would want to promote it.

What I wanted to say was that we should not try to choose
a solution which does not involve undefined-behavior
at all cost.  In particular, if this means going to
something like the cset model because we think we really
have to "make sense" out of infty-as-number, then it's going
to raise lots of other problems, so we should leave
the undefined-behavior door open, and some reasons have
even been given to justify this on a "principle" level as well.

I personnally don't have a strong opinion on this now,
and I think we will discuss plenty of other options
when time comes to it.  Implementation-defined is an
option, but I could also imagine us "requiring a diagnostic",
that is, issue an error or raise a flag (depending on your
point of view from the hardware or programming language),
and there are maybe other alternatives...


NB : I have added one note on my TODO-list for this question
    for the next revision of the C++ interval proposal
    (who knows when this one will be finalized, since we
     probably want C++0x and IEEE-1788 ready before...)

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/