[Cfp-interest 1270] AI about default vs alternate exception handling

Jim Thomas jaswthomas at sbcglobal.net
Sat Mar 2 12:01:46 PST 2019


Action item:
>     Jim: Look to see if there is a place to put a note to address the alternate exception handling in annex F to clarify how C specifies using default exception handling only.
> 


Currently we have

F.8 Floating-point environment
1 The floating-point environment defined in <fenv.h> includes the IEC 60559 floating-point exception
status flags and directed-rounding control modes. It includes also IEC 60559 dynamic rounding
precision and trap enablement modes, if the implementation supports them.383)

F.8.1 Environment management
1 IEC 60559 requires that floating-point operations implicitly raise floating-point exception status
flags, and that rounding control modes can be set explicitly to affect result values of floating-point
operations. These changes to the floating-point state are treated as side effects which respect
sequence points.384)

383)This specification does not require dynamic rounding precision nor trap enablement modes.
384)If the state for the FENV_ACCESS pragma is "off", the implementation is free to assume the dynamic floating-point control
modes will be the default ones and the floating-point status flags will not be tested, which allows certain optimizations (see
F.9).

F.8.1 and footnote 384 are included here for context.

We could add a second paragraph to F.8 to address default vs alternate exception handling, as done below.

“directed-rounding control modes” should be “rounding direction control modes”. "directed-rounding" refers to rounding up, down, toward zero, and alway from zero, as opposed to rounding to nearest. This mistake also appears in footnote 211 (in all-20190211.pdf).

F.8#1and footnote 383 below have been updated. The dynamic rounding precision and trap enablement modes mentioned in F.8 and footnote 383 were features of the original IEEE 754-1985 standard that were not carried over to IEEE 754-2008 (IEC 60559:2011) nor do they appear in IEEE 754-2019. However, some implementations still provide them.

Here’s a suggested replacement for F.8:

F.8 Floating-point environment
1 The floating-point environment defined in <fenv.h> includes the IEC 60559 floating-point exception status flags and rounding direction control modes. It may also include other floating-point status or modes that the implementation provides as extensions.383)

This annex does not include support for IEC 60559’s optional alternate exception handling. The specification in this annex assumes IEC 60559 default exception handling: the flag is set, a default result is delivered, and execution continues. Implementations might provide alternate exception handling as an extension.

F.8.1 ...

383) Dynamic rounding precision and trap enablement modes are examples of such extensions.
384) ...


- Jim Thomas
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20190302/8e27b40a/attachment-0001.html 


More information about the Cfp-interest mailing list