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

Vincent Lefevre vincent at vinc17.net
Thu Sep 23 06:35:45 PDT 2021


On 2021-09-12 18:39:08 -0700, Jim Thomas wrote:
> C Annex F requires default exception handling and doesn’t provide a
> way to change to alternate exception handling. In this context the
> statement is correct.

The C standard does not provide a way to change to alternate
exception handling, but it allows an implementation to do so.
This is the problem here.

There are notes in the standard about that, e.g. 220 in C17 "[...]
enabled traps for floating-point exceptions [...]" and 222 "IEC 60559
systems have a default non-stop mode, and typically at least one other
mode for trap handling or aborting".

There's also F.8 "Floating-point environment", which says "It includes
also IEC 60559 dynamic rounding precision and trap enablement modes,
if the implementation supports them."

F.8.3 makes this clear:

  At program startup the floating-point environment is initialized as
  prescribed by IEC 60559:
[...]
  - Trapping or stopping (if supported) is disabled on all
    floating-point exceptions.

If the intent were to disallow trapping, the standard would not say
"At program startup", but for the whole program execution.

-- 
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