[cfp-interest 3419] constant expressions and floating-point exceptions

Vincent Lefevre vincent at vinc17.net
Wed Mar 19 05:59:23 PDT 2025


Hi,

(I'm several months late in reading messages, but the following
has never been mentioned, AFAIK.)

About 6.6 Constant expressions, the constraints do not exclude
floating-point exceptions, so that any of them may occur
("inexact", "overflow", "underflow", but also "divide-by-zero"
with 1.0/0.0 and "invalid" with 0.0/0.0 when defined, e.g. with
Annex F - ISO/IEC 60559 floating-point arithmetic).

However, 6.6p17 says

  The semantic rules for the evaluation of a constant expression
  are the same as for nonconstant expressions.

But this cannot be true for status flags, as they cannot be raised
at translation time.

-- 
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 / Pascaline project (LIP, ENS-Lyon)


More information about the cfp-interest mailing list