Re: convertFormat and signaling NaN
On 2011-03-13 16:49:55 -0700, Stephen Canon wrote:
We have just been discussing this exact issue in the working group
devising C binding for the revised standard. The C standard document
(§6.3) is quite clear that neither your examples (2) nor (3) can
correspond to the convertFormat operation:
"Conversion of an operand value to a compatible type causes no
change to the value or the representation."
Well, I don't think this necessarily applies to signaling NaNs, which
can be regarded as undefined behavior by the C standard (I'd say that
F.2.1 tends to confirm this: "This specification does not define the
behavior of signaling NaNs."). Said otherwise, the implementation
would still have the choice. And the choice should be made considering
1. what the IEEE 754 specifies (see below);
2. what is thought as best for the user (C programmer).
In order to satisfy the requirements of the convertFormat operation
as written in IEEE-754, it might be necessary then to provide an
explicit same-type convertFormat function in C, separate from the
explicit cast. However, the actual remedy is under discussion. (In
theory, at least, some other remedies are also possible).
For that matter, we were also discussing whether this requirement of
IEEE-754 (convertFormat including same-format conversions) was a
deliberate choice or the result of an oversight. At the time of our
most recent discussion, none of us could remember with certainty
whether or not this was deliberate.
Regarding it as the result of an oversight and specifying same-format
convertFormat as a mere copy would solve in a clean way the problem
with C mentioned above, IMHO. And that's probably what the user would
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 / Arénaire project (LIP, ENS-Lyon)