Talk:cpp/types/numeric limits
Contents |
[edit] Layout change proposal
How about we change the layout from tables to the list of members/constants, similar to most other pages? It gives us the ability to reference specific fnctions/constants individually from elsewhere, gives us a neat sidebar, and lets us expound on the details of any important member with examples and references within its own page, instead of being limited to a cell in a table. Who can tell from the table blurb what in the world does "tinyness_before" mean or how "digits10" is different from "max_digits10"?
Here's how it would look, right after the list of standard specializations,
[edit] Member constants
[static] |
identifies types for which std::numeric_limits is specialized (public static member constant) |
[static] |
identifies signed types (public static member constant) |
[static] |
identifies integer types (public static member constant) |
[static] |
identifies exact types (public static member constant) |
[static] |
identifies floating-point types that can represent the special value "positive infinity" (public static member constant) |
[static] |
identifies floating-point types that can represent the special value "quiet not-a-number" (NaN) (public static member constant) |
[static] |
identifies floating-point types that can represent the special value "signaling not-a-number" (NaN) (public static member constant) |
[static] |
identifies the denormalization style used by the floating-point type (public static member constant) |
[static] |
identifies the floating-point types that detect loss of precision as denormalization loss rather than inexact result (public static member constant) |
[static] |
identifies the rounding style used by the type (public static member constant) |
[static] |
identifies the IEC 559/IEEE 754 floating-point types (public static member constant) |
[static] |
identifies types that represent a finite set of values (public static member constant) |
[static] |
identifies types that handle overflows with modulo arithmetic (public static member constant) |
[static] |
number of radix digits that can be represented without change (public static member constant) |
[static] |
number of decimal digits that can be represented without change (public static member constant) |
[static] |
number of decimal digits necessary to differentiate all values of this type (public static member constant) |
[static] |
the radix or integer base used by the representation of the given type (public static member constant) |
[static] |
one more than the smallest negative power of the radix that is a valid normalized floating-point value (public static member constant) |
[static] |
the smallest negative power of ten that is a valid normalized floating-point value (public static member constant) |
[static] |
one more than the largest integer power of the radix that is a valid finite floating-point value (public static member constant) |
[static] |
the largest integer power of 10 that is a valid finite floating-point value (public static member constant) |
[static] |
identifies types which can cause arithmetic operations to trap (public static member constant) |
[static] |
identifies floating-point types that detect tinyness before rounding (public static member constant) |
[edit] Member functions
[static] |
returns the smallest finite value of the given type (public static member function) |
[static] (C++11) |
returns the lowest finite value of the given type (public static member function) |
[static] |
returns the largest finite value of the given type (public static member function) |
[static] |
returns the difference between 1.0 and the next representable value of this type (public static member function) |
[static] |
returns the maximum possible ISO 10967 rounding error for this type (public static member function) |
[static] |
returns the positive infinity value of the given floating-point type (public static member function) |
[static] |
returns the quiet NaN value of the given floating-point type (public static member function) |
[static] |
returns the signaling NaN value of the given floating-point type (public static member function) |
[static] |
returns the smallest positive denormalized value of the given floating-point type (public static member function) |
[edit] Helper classes
indicates floating-point rounding modes (class) | |
indicates floating-point denormalization modes (class) |
And then within each page, we could list the default value for non-specialized numeric_limits, and the specified values for fundamental types (although the big at-a-glance table in the end of this page is useful too and should be kept, perhaps split between integer and floating-point though), give examples, etc.
--Cubbi 07:40, 5 October 2011 (PDT)
- Looks good to me. Something like this should've been implemented from the start.P12 11:05, 5 October 2011 (PDT)
- Yup, much better. Nate 15:19, 7 October 2011 (PDT)
[edit] specialization for user-defined types
I think that what's in the page now may be incorrect, and that std::numeric_limits cannot be extended to library-defined types, but can be extended by implementations to cover arithmetic types like __int128.