From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BA7D3858413; Sun, 21 Jan 2024 13:35:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BA7D3858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705844117; bh=DLhjkV05QHZhl9FebjOAKA5p5Vrl/EJZfFEtly0cG3c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CPqnGUPOj+BWSn1znNf8ezItV6BouqTMcb6jqLyh2rcN257QACGI0LUPSW6jUm1y7 yIl4KLb+bXv0j4TTD+/0xJgGnu5qwi4rBMjF/PsqBfW7drdx7BaF2wmCksMZOwIoc7 MkGQRptVii1DI9FclZHMz36g/EeJv48Kj6+ok9ag= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/113512] Incorrect results for std::format("{:#.3g}", flt) Date: Sun, 21 Jan 2024 13:35:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113512 --- Comment #1 from GCC Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:a57439d61937925cec48df6166b2a805ae7054d5 commit r14-8315-ga57439d61937925cec48df6166b2a805ae7054d5 Author: Jonathan Wakely 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.=