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

Re: Constructors motion 30 Version 2.



On 2012-02-07 10:07:39 +0000, John Pryce wrote:
> Vincent
> 
> On 6 Feb 2012, at 14:25, Vincent Lefevre wrote:
> >>    [E.g. suppose u decreases below l in nums2interval(l,u). ...
> >>  Does the programmer really want Empty in
> >>    this case? A constructor error is best IMO.]
> > 
> > Actually it depends on the meaning/context of u and l. For instance,
> > the user may have computed an upper bound and a lower bound of some
> > result, and u < l basically means that the problem has no solutions,
> > in which case Empty is what one expects.
> Yes. I would argue that while Empty is often what one expects, it should not be assumed by default...
> 
> > However the user could do
> > l <= u ? nums2interval(l,u) : Empty.
> ... and it is better design that a user be forced to make this test.
> 
> >> I seem to recall Arnold had interesting ideas on combating the
> >> problem of a programmer writing num2interval(0.1) when what's needed
> >> is text2interval("0.1"). Arnold, I've lost this, please remind me.
> > 
> > I'd say that num2interval(expr) should fail unless expr is evaluated
> > exactly (this notion being partly covered by IEEE 754), otherwise the
> > risk of bug would be too high, IMHO. And it is not allowed to fail if
> > expr is a literal that can be represented exactly.
> 
> Yes. This is a language matter, so we can't require it but only
> recommend, I suppose?

The behavior, i.e. what is regarded as an expression for num2interval,
should be specified by the language. For instance, if there are
variables, they could be regarded as leafs or the language could
also track inexactness of the computations that lead to the variable.

Or perhaps num2interval shouldn't be defined at all, keeping just
nums2interval. The user can still write nums2interval(x,x) to get
the interval [x,x], and it makes more clear that nums2interval(x,x)
is a point interval. In particular, one expects num2interval to be
used on very simple arguments, so that nums2interval on twice the
same argument should be sufficient.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)