Re: P1788 input/output
On 2013-07-20 07:12:11 +0100, John Pryce wrote:
> Vincent, P1788
>
> This query by Vincent is ambiguous:
>
> On 2013 Jun 28, at 13:18, Vincent Lefevre wrote:
> > Moreover I suppose that if T is a subset of T' and x is an interval
> > of type T (so that hull_T'(x) = x), it is *not* required that
> >
> > public2interval(interval2public(x),T') = x
> >
> > i.e. the behavior of interval2public is strongly type-dependent, not
> > based on a Level 1 function. But perhaps the above equality should be
> > recommended.
> In the latest draft I renamed these as exact2interval and
> interval2exact. So the query is: If
> (*) s = interval2exact(x) (x is a T-interval so this means
> T-interval2exact(x))
> then is
> (**) x' = T'-exact2interval(s)
> equal to x ?
>
> Well, "no" in the normal sense of Level 2 equality because
> equal(x,x') is simply undefined when x and x' have different types.
> BTW Vincent's hull_T'(x) = x above has no meaning at Level 2 for
> that reason.
The "=" in my comment is a mathematical equality (i.e. Level 1).
> But should be "yes" at Level 1 since (*) maps x to an exact text
> encoding of its Level 1 value, and (**) should recover this value.
But this can be complex, that's why it shouldn't be a requirement,
IMHO. Think about interval types based on constructible numbers for
instance... Text strings could be expressions, and it can be tricky
to need something based on the equality of expressions.
Now, I was also thinking of the usual IEEE 754 conversion property: a
binary number is often output as decimal with enough digits to recover
the original value when interpreting it in rounding-to-nearest in the
same floating-point format. This property is used by the XML schema
spec (datatypes). Hexadecimal output could be a mean to avoid such
type-dependency problems, but with the drawback of being less readable
for a human (though a human may not be expected to read such output...
well, I'm not sure). That's a design choice.
> A follow-up query is whether a (new? change to existing?) Level 2
> equality-comparison operation is needed to test equal(x,x') when
> x,x' are of different types, one being a subset of the other.
> Relevant especially for 754-conforming types, as above.
It should remain optional, possibly except between 754-conforming
types of the same radix, where it should be required, IMHO.
--
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)