public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vincent-gcc at vinc17 dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/114746] New: With FLT_EVAL_METHOD = 2, -fexcess-precision=fast reduces the precision of floating-point constants Date: Tue, 16 Apr 2024 17:51:16 +0000 [thread overview] Message-ID: <bug-114746-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114746 Bug ID: 114746 Summary: With FLT_EVAL_METHOD = 2, -fexcess-precision=fast reduces the precision of floating-point constants Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net Target Milestone: --- -fexcess-precision was added to resolve bug 323, so that with -fexcess-precision=standard, after an assignment or a cast, the value is converted to its semantic type; this conversion makes the program slower, hence -fexcess-precision=fast to have faster programs *without sacrificing their accuracy* in average (except for programs that are based on such a conversion). Said otherwise, the values may be kept with more precision than normally expected. Thus it is not expected that -fexcess-precision=fast reduces the precision of a value. However, with FLT_EVAL_METHOD = 2, -fexcess-precision=fast reduces the precision of floating-point constants compared to what is specified by the standard. This is a much worse issue. Testcase: #include <stdio.h> #include <float.h> int main (void) { printf ("FLT_EVAL_METHOD = %d\n", FLT_EVAL_METHOD); printf ("%La\n%La\n", 1e-8L, (long double) 1e-8); printf ("%a\n%a\n", (double) 1e-8, (double) 1e-8f); return 0; } With GCC 14.0.1 20240330 (experimental) [master r14-9728-g6fc84f680d0] using -m32 -fexcess-precision=fast, I get: FLT_EVAL_METHOD = 2 0xa.bcc77118461cefdp-30 0xa.bcc77118461dp-30 0x1.5798ee2308c3ap-27 0x1.5798eep-27 instead of the expected output (e.g. by using -fexcess-precision=standard) FLT_EVAL_METHOD = 2 0xa.bcc77118461cefdp-30 0xa.bcc77118461cefdp-30 0x1.5798ee2308c3ap-27 0x1.5798ee2308c3ap-27
next reply other threads:[~2024-04-16 17:51 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-16 17:51 vincent-gcc at vinc17 dot net [this message] 2024-04-17 23:18 ` [Bug c/114746] " vincent-gcc at vinc17 dot net 2024-04-17 23:23 ` [Bug c/114746] With FLT_EVAL_METHOD = 2, -fexcess-precision=fast reduces the precision of floating-point constants and floating-point constant expressions vincent-gcc at vinc17 dot net 2024-04-19 16:50 ` jsm28 at gcc dot gnu.org 2024-04-22 9:23 ` vincent-gcc at vinc17 dot net 2024-04-22 12:35 ` jakub at gcc dot gnu.org 2024-04-22 21:50 ` vincent-gcc at vinc17 dot net 2024-05-01 23:37 ` vincent-gcc at vinc17 dot net
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-114746-4@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).