This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD Concepts status.

902. Regular is the wrong concept to constrain numeric_limits

Section: 21.3.4 [numeric.limits] Status: NAD Concepts Submitter: Alisdair Meredith Opened: 2008-09-24 Last modified: 2017-06-16

Priority: Not Prioritized

View other active issues in [numeric.limits].

View all other issues in [numeric.limits].

View all issues with NAD Concepts status.


Addresses FR 32 and DE 16

numeric_limits has functions specifically designed to return NaNs, which break the model of Regular (via its axioms.) While floating point types will be acceptible in many algorithms taking Regular values, it is not appopriate for this specific API and we need a less refined constraint.

FR 32:

The definition of numeric_limits<> as requiring a regular type is both conceptually wrong and operationally illogical. As we pointed before, this mistake needs to be corrected. For example, the template can be left unconstrained. In fact this reflects a much more general problem with concept_maps/axioms and their interpretations. It appears that the current text heavily leans toward experimental academic type theory.

DE 16:

The class template numeric_limits should not specify the Regular concept requirement for its template parameter, because it contains functions returning NaN values for floating-point types; these values violate the semantics of EqualityComparable.

[ Summit: ]

Move to Open. Alisdair and Gaby will work on a solution, along with the new treatment of axioms in clause 14.

Proposed resolution: