Date: Mon, 18 May 2009 11:33:00 +0200
From: Vincent Lefevre <vincent@xxxxxxxxxx>
To: STDS-1788@xxxxxxxxxxxxxxxxx
Subject: Re: A proposal for the next motion
On 2009-05-17 22:34:39 -0400, Nate Hayes wrote:
Vincent Lefevre wrote:
There are (global) flags in IEEE 754-2008. Their scope is
language-defined.
. . .
In this case, like I mention earlier, I believe "local flag" or
"attribute" (which could be implemented as dual op-codes, for
example) is best option, i.e., the user must explicitly define the
behavior when invoking the function. This way, the user can choose
sqrt([-4,-1]) = NaI or sqrt([-4,-1]) = {empty}
without needing to remember to check a global status flag after the
fact (or without needing to change a global control flag before,
either).
That's a possibility, but I'd rather prefer the following one:
sqrt([-4,-1]) = (empty,invalid)
sqrt([-1,4]) = ([0,2],invalid)
i.e. an "invalid" flag is attached to the returned interval.
With this choice, the "invalid" flag is set if and only if
you would get NaI with your choice. This just provides more
information.
Also, I said that instead of attaching the "invalid" flag to
the result, one could have a "status flag" with the meaning of
IEEE 754-2008. The advantage is that if the program produces
lots of output, the user does not need to check each result:
he can simply test the flag.