public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110321] Double precision comaprison does not seem to work well when -std=c++17 option is selected Date: Tue, 20 Jun 2023 15:18:04 +0000 [thread overview] Message-ID: <bug-110321-4-WbO47dOiI4@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110321-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110321 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- As described in the manual, sincve GCC 13.1 -fexcess-precision=standard is enabled by -std=c++NN (but not by -std=gnu++NN). This means the literal 2.2 is represented with excess precision, and so is not equal to the same value converted to double. You can use (a == (double)2.2) to make the comparison work.
next prev parent reply other threads:[~2023-06-20 15:18 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-20 15:14 [Bug c++/110321] New: " serge.ayoun at outlook dot com 2023-06-20 15:18 ` redi at gcc dot gnu.org [this message] 2023-06-20 15:21 ` [Bug c++/110321] " pinskia at gcc dot gnu.org 2023-06-20 15:31 ` redi at gcc dot gnu.org 2023-06-20 16:21 ` serge.ayoun at outlook dot com
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-110321-4-WbO47dOiI4@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).