Re: P1788 input/output: exact text representation
On 2013-07-24 19:31:28 +0200, Christian Keil wrote:
> Am Tue, 23 Jul 2013 21:39:28 +0100
> schrieb John Pryce <j.d.pryce@xxxxxxxxxx>:
>
> > However, I think Michel's observation about writing from one type and
> > reading to another is both perceptive and valuable.
> >
> > Namely suppose type T' is wider than type T, meaning that regarded as
> > sets of mathematical intervals, T is a subset of T'.
> >
> > Then if
> > xx is a T-interval
> > and we write xx out by
> > s = T-interval2exact(xx).
> > Michel says string s *should* be readable by T'-exact2interval and
> > recover xx exactly: yy = T'-exact2interval(s)
> > should be defined, and should have the same interval value as xx
> > (though of a different type).
> >
> > E.g. to fix ideas, let T be inf-sup binary32 and T' be inf-sup
> > binary64. Then interval yy should be just xx converted from single to
> > double precision, but
> >
> > In fact, with the spec as given so far, this happens automatically if
> > T and T' are 754-conforming types. I'm working on writing a suitable
> > "should" statement for general types.
>
> This seems to fall out of the current spec automatically, yes. But if
> it doesn't in a more general way, than I would prefer to keep it simple
> here.
>
> If the importing system supports the originally used type, there is
> always the possibility to read to the correct format and convert to a
> wider one afterwards. The situation were the original format is not
> supported seems quite special to me and probably doesn't deserve extra
> handling if it complicates the standard, does it?
Yes, I think that guaranteeing that a string output by some
T-interval2exact is readable by any T'-exact2interval is impossible
in general. So, the user should avoid such combinations. The standard
could make some recommendations in specific cases, in particular
because the result would be more intuitive (probably more for OO
languages).
--
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)