https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113512
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:1bb2e52cc69902c7bf00fbdd094e948803222946 commit r13-8261-g1bb2e52cc69902c7bf00fbdd094e948803222946 Author: Jonathan Wakely <jwak...@redhat.com> Date: Sat Jan 20 00:44:12 2024 +0000 libstdc++: Fix std::format floating-point alternate forms [PR113512] The logic for handling '#' forms was ... not good. The count of significant figures just counted digits, instead of ignoring leading zeros. And when moving the result from the stack buffer to a dynamic string the exponent could get lost in some cases. libstdc++-v3/ChangeLog: PR libstdc++/113512 * include/std/format (__formatter_fp::format): Fix logic for alternate forms. * testsuite/std/format/functions/format.cc: Check buggy cases of alternate forms with g presentation type. (cherry picked from commit a57439d61937925cec48df6166b2a805ae7054d5)