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

Re: Compressed intervals again (was: Draft decoration system...)



On 2012-12-15 11:11:05 +0000, John Pryce wrote:
> Vincent
> 
> On 14 Dec 2012, at 08:54, Vincent Lefevre wrote:
> > It should be explicit that normalInterval() is a function that
> > depends on the threshold. I suggest to say tau-normalInterval()
> > and sigma-normalInterval() for more clarity.
> OK. But I was thinking to overload it, since the type of the input
> can specify which actual operation is chosen.

Overloading is fine in OO languages, but can be confusing in
specification, in particular because one usually does the opposite
in math (e.g. the set of integers Z is regarded as a subset of R
instead of a disjoint set). Overloading can be OK only when the
result would be the same (in math or at Level 1: 1 + 2 has the
same result 3, whether you regard + as an operation on the integers
or on the real numbers) or when there isn't any risk of confusion.

> More generally, what should the standard say about names of
> operations in the text and their names in a programming language? At
> the moment at start of 8.6 "Required operations" has (lifted from
> 754-2008 somewhere)

The programming languages can choose any name. So, I don't think that
the standard should say anything, except:

> > The names of operations in this standard, as well as symbols used
> > for operations (e.g., for the comparisons in §8.6.9), may not
> > correspond to those that any particular language would use.
> 
> But this should really be said much earlier, in the
> flavor-independent text (Ch 1),

If there is a section about conformance, it could be there.

> and it needs a more careful statement of policy on overloading
> operation-names. Something like
> > The names of operations in this standard, as well as symbols used
> > for operations (e.g., for the comparisons in §8.6.9), may not
> > correspond to those that any particular language would use.

OK

> > Especially at Level 2, a generic (overloaded) operation-name may
> > be used when the actual operation -- in particular the type of the
> > result -- can be uniquely inferred from the input operands.
> > [Example. The names of interval arithmetic operations such as
> > xx+yy, and comparisons such as xx<=yy, can be overloaded since the
> > standard specifies what input-type combinations shall be
> > supported, and the result-type in each case. However, constructors
> > such as <type>-nums2interval(a,b) include the name of the
> > result-type to remove ambiguity. Similarly, operations such as
> > midpoint <format>-mid(xx) include the name of a numeric
> > result-format.]

Yes. Note that something like <type>-nums2interval(a,b) is needed
because this is a way to say that there may be several functions for
the same inputs, like with all the formatOf operations.

-- 
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)