public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/108046] The dot in the floating-point alternative form has wrong position Date: Thu, 27 Jul 2023 15:03:12 +0000 [thread overview] Message-ID: <bug-108046-4-rG2W9MNlHx@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108046-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108046 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>: https://gcc.gnu.org/g:50bc490c090cc95175e6068ed7438788d7fd7040 commit r14-2825-g50bc490c090cc95175e6068ed7438788d7fd7040 Author: Jonathan Wakely <jwakely@redhat.com> Date: Thu Jul 27 14:07:09 2023 +0100 libstdc++: Fix std::format alternate form for floating-point [PR108046] A decimal point was being added to the end of the string for {:#.0} because the __expc character was not being set, for the _Pres_none presentation type, so __s.find(__expc) didn't the 'e' in "1e+01" and so we created "1e+01." by appending the radix char to the end. This can be fixed by ensuring that __expc='e' is set for the _Pres_none case. I realized we can also set __expc='P' and __expc='E' when needed, to save a call to std::toupper later. For the {:#.0g} format, __expc='e' was being set and so the 'e' was found in "1e+10" but then __z = __prec - __sigfigs would wraparound to SIZE_MAX. That meant we would decide not to add a radix char because the number of extra characters to insert would be 1+SIZE_MAX i.e. zero. This can be fixed by using __z == 0 when __prec == 0. libstdc++-v3/ChangeLog: PR libstdc++/108046 * include/std/format (__formatter_fp::format): Ensure __expc is always set for all presentation types. Set __z correctly for zero precision. * testsuite/std/format/functions/format.cc: Check problem cases.
next prev parent reply other threads:[~2023-07-27 15:03 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-10 11:12 [Bug libstdc++/108046] New: " hewillk at gmail dot com 2022-12-10 12:11 ` [Bug libstdc++/108046] " redi at gcc dot gnu.org 2023-04-26 6:57 ` rguenth at gcc dot gnu.org 2023-07-27 9:24 ` rguenth at gcc dot gnu.org 2023-07-27 15:03 ` cvs-commit at gcc dot gnu.org [this message] 2023-07-27 15:04 ` redi at gcc dot gnu.org 2023-09-27 16:17 ` cvs-commit at gcc dot gnu.org 2023-09-27 16:19 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-108046-4-rG2W9MNlHx@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).