-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Reference (section label): [basic.fundamental]
See cplusplus/draft#8554 for prior discussion
Issue description
While library wording such as in [numeric.limits.members] mentions various possible values for floating-point types, the specific requirements for what a floating-point type may represent are not obvious. In particular:
- Can there be an unsigned zero, infinity, or NaN value?
- Conversely, can there be a signed zero, infinity, or NaN value?
- Can there be a negative zero and an unsigned infinity, or is the "signedness requirement" all-or-none?
- Can an extended floating-point type be so imprecise that it is incapable of representing any number? That is, could an
infinity-ttype in the style ofnullptr_tbe considered a floating-point type?
The intended model (matching C23) is for some numbers to be representable, while non-finite values are individually signed or unsigned.
Suggested resolution
Immediately prior to [basic.fundamental] paragraph 13, insert a new paragraph:
A floating-point type shall at least represent a subset of rational numbers.
Depending on the implementation-defined value representation for the type, it may additionally represent the non-finite values
- infinity,
- a set of quiet "Not a Number" values,
- a set of signaling "Not a Number" values, and
- additional implementation-defined values.
For any of the above (including zero), a floating-point type may either represent a single unsigned value or two distinct values with negative and positive sign.
[Note: A floating-point type which adheres to ISO/IEC 60559 is capable of representing a negative and positive variant of all but the last bullet ([numeric.limits.members]). --end note]