Date: Wed, 24 Jun 2026 09:23:01 +0200
On Tue, 23 Jun 2026 at 23:47, Tiago Freire <tmiguelf_at_[hidden]> wrote:
> One thing that could be improved is the multiple references to “ISO/IEC
> 60559:2020” but it doesn’t show up in the reference section of the paper.
>
>
>
> Some of the traits I use myself and would recommend you take a look:
>
>
>
> Ex. IEE759 float
>
> max_scientific_exponent_10 = 38; - Maximum exponent that a finite number
> represented in base 10 scientific notation can have
>
> min_scientific_exponent_10 = -45; - Minimum exponent that a finite number
> represented in base 10 scientific notation can have
>
> max_scientific_decimal_digits_10 = 111; - Maximum number of decimal digits
> required to represent any finite number in base 10 scientific notation
> exactly.
>
> max_scientific_precision_10 = max_scientific_decimal_digits_10; - Maximum
> number of precision digits you can request from a floating-point to text
> formatting function using base 10 scientific notation.
>
> max_scientific_exponent_digits_10 = 2; - Max number of digits an exponent
> can have when representing a finite number in base 10 scientific notation
>
> max_fixed_decimal_digits_10 = 149; - Maximum number of decimal digits
> required to represent any finite number in base 10 fixed point notation
> exactly
>
> max_fixed_unit_digits_10 = 39; - Maximum number of unit digits required to
> represent any finite number in base 10 fixed point notation
>
> max_fixed_precision_10 = 149; - Maximum precision digits you can request
> from a floating-point to text formatting function using base 10 fixed point
> notation.
>
> min_fixed_precision_10 = -38; - Minimum precision digits you can request
> from a floating-point to text formatting function using base 10 fixed point
> notation.
>
> max_shortest_digits_10 = 9; - Number of significant digits required to
> format any finite floating point number using round-trip shortest notation.
>
Hmm yeah. I can see these kinds of properties being quite useful when you
want to implement your own floating-point stringification, or just to
assist with std::to_chars usage. That is, if you want to print a float into
a fixed-size buffer, how many digits do you need?
I think numeric_limits::max_digits10 tells you how many digits you need in
scientific notation, but that's only a part of the information. It doesn't
tell you how many digits there are in fixed decimal notation for example
before you get an infinite sequence of trailing zeros. It also doesn't tell
you how many exponent digits there could be.
P2551 Clarify intent of P1841 numeric traits
> https://github.com/cplusplus/papers/issues/1211
> and
> P1841 Wording for Individually Specializable Numeric Traits
> https://github.com/cplusplus/papers/issues/594
> I think the general direction already got LEWG approval,
> but the paper is waiting for the paper author to apply
> the changes from P2551, as far as I can remember.
> Please discuss the next steps with the author of P1841.
Yeah, thanks for providing that context. I've reached out to Walter, and I
think you're right that LWG is just waiting for him to apply those wording
changes since 2022.
Unfortunately I don't think that what I'm trying to do and what prior
papers try to do are really aligned. When trying to extract dozens
(potentially over a hundred) floating-point-specific properties from a
type, I'm not convinced that every single one of those properties should be
a top-level, individually specializable trait.
Things do become simpler if there is one std::float_traits trait which only
works for floats, rather than trying to individually answer for 100 traits
what "exponent_bits_v<int>" means, among many, many, other questions.
Jan
> One thing that could be improved is the multiple references to “ISO/IEC
> 60559:2020” but it doesn’t show up in the reference section of the paper.
>
>
>
> Some of the traits I use myself and would recommend you take a look:
>
>
>
> Ex. IEE759 float
>
> max_scientific_exponent_10 = 38; - Maximum exponent that a finite number
> represented in base 10 scientific notation can have
>
> min_scientific_exponent_10 = -45; - Minimum exponent that a finite number
> represented in base 10 scientific notation can have
>
> max_scientific_decimal_digits_10 = 111; - Maximum number of decimal digits
> required to represent any finite number in base 10 scientific notation
> exactly.
>
> max_scientific_precision_10 = max_scientific_decimal_digits_10; - Maximum
> number of precision digits you can request from a floating-point to text
> formatting function using base 10 scientific notation.
>
> max_scientific_exponent_digits_10 = 2; - Max number of digits an exponent
> can have when representing a finite number in base 10 scientific notation
>
> max_fixed_decimal_digits_10 = 149; - Maximum number of decimal digits
> required to represent any finite number in base 10 fixed point notation
> exactly
>
> max_fixed_unit_digits_10 = 39; - Maximum number of unit digits required to
> represent any finite number in base 10 fixed point notation
>
> max_fixed_precision_10 = 149; - Maximum precision digits you can request
> from a floating-point to text formatting function using base 10 fixed point
> notation.
>
> min_fixed_precision_10 = -38; - Minimum precision digits you can request
> from a floating-point to text formatting function using base 10 fixed point
> notation.
>
> max_shortest_digits_10 = 9; - Number of significant digits required to
> format any finite floating point number using round-trip shortest notation.
>
Hmm yeah. I can see these kinds of properties being quite useful when you
want to implement your own floating-point stringification, or just to
assist with std::to_chars usage. That is, if you want to print a float into
a fixed-size buffer, how many digits do you need?
I think numeric_limits::max_digits10 tells you how many digits you need in
scientific notation, but that's only a part of the information. It doesn't
tell you how many digits there are in fixed decimal notation for example
before you get an infinite sequence of trailing zeros. It also doesn't tell
you how many exponent digits there could be.
P2551 Clarify intent of P1841 numeric traits
> https://github.com/cplusplus/papers/issues/1211
> and
> P1841 Wording for Individually Specializable Numeric Traits
> https://github.com/cplusplus/papers/issues/594
> I think the general direction already got LEWG approval,
> but the paper is waiting for the paper author to apply
> the changes from P2551, as far as I can remember.
> Please discuss the next steps with the author of P1841.
Yeah, thanks for providing that context. I've reached out to Walter, and I
think you're right that LWG is just waiting for him to apply those wording
changes since 2022.
Unfortunately I don't think that what I'm trying to do and what prior
papers try to do are really aligned. When trying to extract dozens
(potentially over a hundred) floating-point-specific properties from a
type, I'm not convinced that every single one of those properties should be
a top-level, individually specializable trait.
Things do become simpler if there is one std::float_traits trait which only
works for floats, rather than trying to individually answer for 100 traits
what "exponent_bits_v<int>" means, among many, many, other questions.
Jan
Received on 2026-06-24 07:23:18
