[Cfp-interest 2153] Re: defect in ISO C about underflow with exact subnormal

Vincent Lefevre vincent at vinc17.net
Sun Sep 26 17:10:29 PDT 2021


On 2021-09-26 14:17:20 -0700, Jim Thomas wrote:
> The relevant text noted in [Cfp-interest 2106] is:
> 
> > F.9.2 "Expression transformations":
> > 
> >  1 × x and x/1 → x     The expressions 1 × x, x/1, and x may be
> >                        regarded as equivalent (on IEC 60559 machines,
> >                        among others).399)
> > 
> >  399) Strict support for signaling NaNs — not required by this
> >  specification — would invalidate these and other transformations
> >  that remove arithmetic operators.
> 
> F.8 #2 says “… The specification in this annex assumes IEC 60559
> default exception handling ….” Given that, I think the statement is
> correct.

The current ISO C standard C17 does not have this paragraph. So there
is still a defect in C17. Indeed, C2x has this new paragraph, so that
the statement becomes correct (I was not aware of this addition).

However, this might need to be clarified. #1 says "It may also include
other floating-point status or modes that the implementation provides
as extensions.394)" with Note 394 being "Dynamic rounding precision
and trap enablement modes are examples of such extensions."

Basically, this says that extensions are allowed ("may"), but then
such extensions are not supported. This is a bit confusing. Moreover,
Note 394 also mentions dynamic rounding precision, for which #2 is
silent, and I believe that some parts of the spec are wrong with that.

> Since we do mention alternate exception handling in other contexts,
> we might consider expanding the footnote:
> 
> 399) Strict support for signaling NaNs and alternate exception
> handling — neither required by this specification — would invalidate
> these and other transformations that remove arithmetic operators.

Yes, this would be useful.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the Cfp-interest mailing list