[cfp-interest 4007] Re: Action: range of representble values, revisited

Joshua Cranmer joshua.cranmer at intel.com
Wed Sep 23 13:11:16 PDT 2026


On 9/23/2026 15:40, Jerome Coonen wrote:
> Here is the proposal to simplify and clarify this language. 
> First 5.3.5.3.3p19  from:
>
> The minimum range of representable values for a floating type is the 
> most negative finite floating-point
> numberrepresentable 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.
>
> To:
>
> The range of representable values for a floating type is the 
> collection of representable finite, infinite, and NaN values.
>
I strenuously disagree with this wording.

Looking in the latest draft, the phrase "range of representable values" 
occurs 11 times, and the relevant uses for FP outside of its definition are:

6.4.5:

> Each constant shall have a type and the value of a constant shall be 
> in the range of representable
> values for its type.
6.5.1:
> If an exceptional condition occurs during the evaluation of an 
> expression (that is, if the result is not
> mathematically defined or not in the range of representable values for 
> its type), the behavior is
> undefined.
6.6.1:

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

The first and last uses are creating semantic constraints; if the result 
is not in the range of representable values, then it creates a compiler 
error.

The wording you propose, however, includes only those values that are 
representable in the type. Since 0.1 is not representable as a binary 
floating-point number, your wording would seem to indicate that double x 
= 0.1; becomes a compiler error. Any wording needs to clearly anticipate 
that values which lie within the minimum and maximum values are in the 
range of representable values, even if the exact value itself cannot be 
represented.

I'll point out again that C++ has emphatically decided that C 
intentionally excluded infinities from the range of representable 
values. I don't have a strong opinion on that matter, though having 
spent the past few hours trying to reconcile the C and C++ definitions 
of constexpr as it relates to floating point, I have come to conclusion 
that there's an elaborate game of telephone being played here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20260923/07d86ad8/attachment-0001.htm>


More information about the cfp-interest mailing list