Issue 1085: Non-finite values in arithmetic constant expressions

Authors: Jay Ghiron
Date: 2026-06-23
Submitted against: C23
Status: Open
Cross-references: 0025

Each constant expression shall evaluate to a constant that is in the range of representable values for its type.

(C23 6.6 "Constant expressions" paragraph 4.)

The range of representable values of a floating type is defined as such:

The minimum range of representable values for a floating type is the most negative finite floating-point number representable in that type through the most positive finite floating-point number representable in that type. In addition, if negative infinity is representable in a type, the range of that type is extended to all negative real numbers; likewise, if positive infinity is representable in a type, the range of that type is extended to all positive real numbers.

(C23 5.3.5.3.3 "Characteristics of floating types" paragraph 19.)

The range of representable values is only described as including real numbers, which infinities and NaNs are by definition not. Therefore it appears that an expression with a non-finite value cannot be used in a context which requires constant expressions. I assume this is not the intent though, since INFINITY and NAN are required to be arithmetic constant expressions if they are defined.

A correction should also consider clarifying if "its type" refers to the semantic type or the type considering FTL_EVAL_METHOD. That is, if the extra range can be used when the semantic type does not support infinities.