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

Re: Portable syntax of interval literals



Well, Richard, if simplicity is really your goal, that can easily be achieved with a one sentence standard which says do what ever you want as long as you don't violate the containment constraint. :)

Cheers,

Bill


On 9/28/13 8:05 AM, Richard Fateman wrote:
I'm sympathetic to the notion, but the reality of implementation between any two implementations of P1788 is adding a level of complexity that may not be warranted by the value achieved.

There is an interchange standard for IEEE754 numbers specifying the endpoint of the intervals, namely as IEEE754 numbers. So unless I'm mistaken on this, the problem does not exist here (is Inf and NaN covered?)

Perhaps any non-IEEE754 system could be programmed to output or input such standards as they already exist in IEEE754, with the understanding that -- if the internal interval endpoints are not exactly representable-- the interval should be widened on output. If the inputs are not exactly representable in the internal form, the conversion should
widen the interval.

In the unlikely event that you have TWO non-IEEE754 systems communicating with each other, they might make TWO widenings.

This seems to cover most (all?) cases except when both systems are higher precision and then there is the option of transmission using exact arbitrary-precision ratios or integer X 2^exponent.

I think an important motivation for any motion at this time is that it be very simple and not clutter up the standard or slow the approval process. Catering to the prospect of any and all unknown non-IEEE754 P1788 systems imaginable might be an interesting exercise
for some future addendum.

RJF



On 9/28/2013 7:31 AM, G. William (Bill) Walster wrote:
In my opinion, there should be no "tightness requirement" in the standard. Tightness is an implementation feature like speed. Are there any interval speed requirements in the standard?

Dima, Portable literals are a great implementation feature.

Thanks for mentioning it.

Of course, when implemented with intervals, the only requirement should be that containment constraint is never violated.

Cheers,

Bill




On 9/27/13 6:38 PM, Dmitry Nadezhin wrote:
Ned, Juergen,

I work on syntax of portable interval literals that I would like to submit as a motion. Portable literals permit users to exchange files with interval literals between
different P1788 implementations that doesn't know about each other.
Any implementation may extend syntax of interval literals and may emit strings that are not portable literals, but there shall be a conversion specifier "cs" that forces to emit strings that are portable literals. Any implementation shall parse portable literals and return their valid enclosure though
it may accept strings with non-portable interval literals too.

When we discussed Motion 48, you insisted that rational notation inside intervlal literals like [1/3] SHOULD be supported (not SHALL) and that implementation "may restrict the support of literals, by limiting the length of the string or in other ways". I understand that you want to simplify implementations. However, this prevents implementations that support intervals with rational bounds to exchnge number literals with out loss of accuracy.

Yes, implementation need some additional code to convert interval literals with rational notation. The main difficulty is not in parsing this notation, but in computation of tightest bounds of [p/q] when p and q have many decimal digits. The tightest bounds in infsup_F datatype are x_inf = roundDown(p/q), x_sup = roundUp(p/q). Its computation may be difficult.
However, it is easy to compute accurate bounds:
x_inf is either roundDown(p/q) or nextDown(roundDown(p/q));
x_sup is either roundUp(p/q) or nextUp(roundUp(p/q)) .

Sitiation with long mixed-radix number literals [l,u] is similar. It is easy to parse them, it is difficult to check l<=u exactly. It is easy to check l <= u approximately , with possible false positives.

Do you have objections that each implementation of textToInterval(s) SHALL parse any string that is portable interval literals ( even if it is very long or if it contains rational notation ) but implementation may compute accurate bounds instead of tightest in this case ?

I can prepare a collection of sample implementations of "textToInterval" in C language under permissive license in order help implementators. I already have prepaired (and gave links to Juergen): 1) A simple tightest implementation based on GMP, though ti may require large time and memory to check l <= u exactly and to compute tightest enclosure; 2) An proof of concept implementation. It doesn't depend on other libraries. It doesn't allocate dynamic memory, but uses static memory proportional to exponent range of F. It computes tightest enclosure, thoght is permits false positives in l <= u test.

Perhaps, I might prepare yet another implementation that depends only on 754-conforming strtod(), uses fixed memory proportional to mantissa length,
but computes only accurate enclosure.

   -Dima