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

Re: An amendment to the motion P1788.1/M004.02



Dima,

   Thanks, I did not notice the requirements of both
numbers having the same basis.

    Actually, I use gmp to handle the "difficult" cases
and it would take an indeed very difficult case
in order for my constructor to fail.

    Is there a relevant practical case in which one
would use an IEEE 754 type (double, float
or long double) in which a really difficult
case would ever happen?

                walter.


On Mon, Sep 26, 2016 at 3:47 PM, Dmitry Nadezhin <dmitry.nadezhin@xxxxxxxxxx> wrote:
Dear Walter,

The text of the motion M004.02 says in 6.6.2 that interval literal is
"A string [ l , u ] where l and u are optional number literals of the same radix (10 or 16) with l <= u,
l < +oo and u > -oo, see 4.2...."
In a string s = "[ 0x0.0p0 , 1.0 ]" l is of radix 16 and u is of radix 10.
So string s is not an interval literal.
Hence the constructor textToIInterval(s) must fail with result [ Empty ] and signal
InvalidOperation exception.

This differs from 1788 where "[ 0x0.0p0 , 1.0 ]" is an interval literal.

  -Dima

 
----- Original Message -----
From: walter.mascarenhas@xxxxxxxxx
To: dmitry.nadezhin@xxxxxxxxxx
Cc: stds-1788@xxxxxxxxxxxxxxxxx
Sent: Monday, September 26, 2016 9:04:51 PM GMT +03:00 Iraq
Subject: Re: An amendment to the motion P1788.1/M004.02

Dear Dima,

   I am working on implementing P1788.1 at this
very moment, and I do not see why your
string

char *s = "[ 0x0.0p0 , 1.0 ]";

 would lead to empty instead of [0.0, 1.0].
Why is this the case?

           regards,

                walter.


On Mon, Sep 26, 2016 at 2:46 PM, Dmitry Nadezhin <dmitry.nadezhin@xxxxxxxxxx> wrote:
Dear colleagues,

The motion M004.02 passed.
Syntax of interval literals in this motion is restricted against syntax in interval literals in 1788-2015.
Later discussion showed that such a restriction makes difficult
to follow the principle formulated in the section 1.1 of P1788.1:
"A program built on top of an implementation of IEEE P1788.1 should compile and run,
and give identical output within round off, using an implementation of IEEE Std 1788-2015, or any superset of the former."

Here is a program that illustrates this:
-----
char *s = "[ 0x0.0p0 , 1.0 ]";
bareInterval x = textToBareInterval (s);
if (isEmpty(x))
  printf("1788.1\n");
else
  printf("1788\n");
-----

1788.1 (as of M004.02) returns the Empty but this is containment violation in 1788 .

A possible solution of this contradiction is to preserve in 1788.1 syntax of 1788 interval literals.
Some literals are difficult for implementation, but 1788.1 would relax accuracy mode of textToInterval(s)
constructor on difficult strings instead of forbidding them.
Relaxation of accuracy mode on difficult strings doesn't contradict 1788. See the last paragraph
of the section 9.8 of 1788 .

Modified level2.pdf is attached.
It describes full syntax of interval literals in a style simpler than in 1788.
It also formulates relaxed accuracy of textToInterval(s) on difficult input strings.
Additions are in blue color, removal is in red color.

Please consider this as an amendment to M004.02 .

Best Regards,
  -Dima