[std-interval] Interval comparison operators

Guillaume Melquiond guillaume.melquiond at ens-lyon.fr
Thu Apr 27 12:05:56 PDT 2006


Le mercredi 26 avril 2006 à 17:11 -0700, Ron Avitzur a écrit :

> A tradeoff is that then examples such as this need to be written in a 
> way that is less elegant.
[...]
> An appropriate question here is, how often is it useful to have 
> functions template <class T> f(....) were T can be either scalar or 
> interval?

Not that often, I would say. Yet, whenever you are using intervals to
control roundoff errors on a scalar type, it makes sense to use the same
syntax for both the code using the scalar type and the code using the
interval type. An exception is then thrown when two computed values are
too close for being comparable due to roundoff errors.

Anyway, the default implicit conversion to bool is a concern I
understand. A solution would be to require it to be explicit, something
similar to possibly and certainly (I don't have any idea of a good name
though). It would still be possible to annotate the scalar code with
dummy identity functions so that it remains generic.

Best regards,

Guillaume



More information about the Std-interval mailing list