Title
Meaning of numeric_limits<T>::is_exact is unclear
Status
new
Section
[numeric.limits.members]
Submitter
Jan Schultke

Created on 2026-07-17.00:00:00 last changed 3 days ago

Messages

Date: 2026-07-18.15:00:27

Proposed resolution:

This wording is relative to N5054.

  1. Modify [numeric.limits.members] as indicated:

    static constexpr bool is_exact;
    

    -20- `true` if the type uses an exact representation; that is, if there exist no unrepresentable values in the domain of the type that lie between representable values.

    [Note: Floating-point representations are not exact because their domain is the (possibly extended) real numbers, and there are infinite values in the domain between any two representable floating-point values. All integer types are exact, but not all exact types are integer. For example, rational and fixed-exponent representations are exact but not integer because their domain is the scaled integer domain. Rational number representations are exact only if the numerator and denominator are unbounded. — end note]

    -21- Meaningful for all specializations.

Date: 2026-07-17.00:00:00

The description of the `numeric_limits::is_exact member` in [numeric.limits.members] is as follows:

`true` if the type uses an exact representation. All integer types are exact, but not all exact types are integer. For example, rational and fixed-exponent representations are exact but not integer.

There is no explanation of what an "exact representation" is, and there is no widely established definition in math. User confusion can be seen on stackoverflow.

It is also extremely surprising that rational and fixed-point representations would be considered exact, considering that unless those are infinite-precision representations (such as fixed-point representation backed by a "big integer" type), sufficiently tiny values obviously cannot be represented. There is no meaningful difference between fixed-point and floating-point types in this regard, other than the size of the gaps between values in the representable subset of real numbers.

However counter-intuitive the wording may be, the examples listed match existing practice:

History
Date User Action Args
2026-07-18 15:00:27adminsetmessages: + msg16528
2026-07-17 00:00:00admincreate