[std-interval] More on interval computations as proofs

Guillaume Melquiond guillaume.melquiond at ens-lyon.fr
Sun Oct 1 14:17:45 PDT 2006


Le samedi 30 septembre 2006 à 14:44 -0700, Steve Clamage a écrit :
> About errno, ignoring threading issues:
[...]
> Using errno as a reliable and general-purpose error indicator is not 
> realistic.

I would like to stress that Sylvain's suggestion was not about using
errno. He only mentioned errno because implementations supporting
threads already have the correct thread-local semantic for it. For
intervals, we are not speaking about a "general-purpose error
indicator".

We just need a boolean flag that is raised when any interval function
encounters an out-of-domain condition when performing a computation.
Similarly to errno that is "never set to zero by any library
function" (C Standard, POSIX standard, etc), this flag would never be
cleared by any interval function.

As this is only a boolean flag, the cause for raising the flag is never
overwritten: it's necessarily an out-of-domain condition. I also want to
stress that raising this flag does not mean that an error happened, so
throwing an exception is no good, as it would prevent performing the
whole computation.

The only functions concerned by this flag should be the 13 mentioned by
Ron Avitzur, plus nth_root and pow. They all already have to check for
out-of-domain conditions, as they could easily return non-sense results
otherwise. So the only runtime cost is in raising the flag, and this
isn't supposed to happen often. On any decent environment, I expect this
cost to be undetectable (on a NTPL implementation for example, raising a
thread-local flag is nothing more than a simple memory store).

To summarize my point on this issue: if I was sure that the next C++
Standard is going to correctly support multi-threading, I wouldn't have
suggested the explicit flag approach. I would instead have pushed for
the implicit flag, as this is what interval users really expect. They
don't want to carry a flag all around, they just want to clear the flag,
do all their interval computations, and check the flag at the end.

Best regards,

Guillaume




More information about the Std-interval mailing list