From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E29D0385801E; Tue, 30 Jan 2024 14:54:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E29D0385801E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706626490; bh=+ZEFt53n07hzYSOVG9bK89/JLlb9jV+Yznyc6mXfL4g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ye/E2BYQ7MPS2h/1R6FC0b3K54LxY1S1CcwbHO0o2HOLY8sDU9KGL9cX19ma3iuqC FMgKobwjvo5VYhRP1ZCG/QA/TtCbRVxX84dtlyH+EorEFjAriBGGJ/XJHt1WisP63I G6JbzUeXcZE6Eqf5vVT/W7RQGez9hQQWdsvv4fiI= 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: Tue, 30 Jan 2024 14:54:49 +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 #2 from GCC Commits --- The releases/gcc-13 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:1bb2e52cc69902c7bf00fbdd094e948803222946 commit r13-8261-g1bb2e52cc69902c7bf00fbdd094e948803222946 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. (cherry picked from commit a57439d61937925cec48df6166b2a805ae7054d5)=