From 041ef3e3991fb6ca1a53cc7219f4d1ba425a55b5 Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Sun, 14 Jun 2026 18:58:02 +0200 Subject: [PATCH] P3505R4 Fix the default floating-point representation in std::format --- source/support.tex | 2 +- source/text.tex | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/support.tex b/source/support.tex index 70028e6719..afaf438d6d 100644 --- a/source/support.tex +++ b/source/support.tex @@ -866,7 +866,7 @@ #define @\defnlibxname{cpp_lib_three_way_comparison}@ 201907L // freestanding, also in \libheader{compare} #define @\defnlibxname{cpp_lib_to_address}@ 201711L // freestanding, also in \libheader{memory} #define @\defnlibxname{cpp_lib_to_array}@ 201907L // freestanding, also in \libheader{array} -#define @\defnlibxname{cpp_lib_to_chars}@ 202306L // also in \libheader{charconv} +#define @\defnlibxname{cpp_lib_to_chars}@ 202606L // also in \libheader{charconv} #define @\defnlibxname{cpp_lib_to_string}@ 202306L // also in \libheader{string} #define @\defnlibxname{cpp_lib_to_underlying}@ 202102L // freestanding, also in \libheader{utility} #define @\defnlibxname{cpp_lib_transformation_trait_aliases}@ 201304L // freestanding, also in \libheader{type_traits} diff --git a/source/text.tex b/source/text.tex index 549d6f32e0..fcee975569 100644 --- a/source/text.tex +++ b/source/text.tex @@ -174,13 +174,18 @@ \begin{itemdescr} \pnum \effects +Let \tcode{T} be \tcode{\placeholder{floating-point-type}}. \tcode{value} is converted to a string in the style of \tcode{printf} in the \tcode{"C"} locale. -The conversion specifier is \tcode{f} or \tcode{e}, -chosen according to the requirement for a shortest representation -(see above); -a tie is resolved in favor of \tcode{f}. +The conversion specifier is \tcode{f} if +the absolute value of \tcode{value} is in the range $[l, u)$, where +$l$ is the smallest value larger or equal to $10^{-4}$ +that is representable by \tcode{T} and +$u$ is the largest value smaller or equal to +$\tcode{std::numeric_limits::radix}^{\tcode{std::numeric_limits::digits+1}}$ +rounded down to the nearest power of 10 representable by \tcode{T}, +otherwise \tcode{e}. \pnum \throws