public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bugdal at aerifal dot cx" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/52593] Builtin sqrt on x86 is not correctly rounded Date: Thu, 15 Mar 2012 17:25:00 -0000 [thread overview] Message-ID: <bug-52593-4-enU7YEeTle@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-52593-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52593 --- Comment #2 from Rich Felker <bugdal at aerifal dot cx> 2012-03-15 16:37:25 UTC --- Tested with gcc 4.6.2. #include <stdio.h> #include <math.h> int main() { volatile double x = 0x1.fffffffffffffp-1; volatile double y = sqrt(x); printf("%a\n", y); } Compile with -O2 -ffloat-store, and this program gives an output of 0x1p+0, rather than the correct output of 0x1.fffffffffffffp-1. Unfortunately it's impossible to get the correct output with glibc's -lm version of sqrt either since it has the exact same bug. But you can look at the generated assembly with and without -fno-builtin-sqrt and see that the version with builtin sqrt is wrong (using the fsqrt opcode directly).
next prev parent reply other threads:[~2012-03-15 16:37 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-15 6:00 [Bug target/52593] New: " bugdal at aerifal dot cx 2012-03-15 9:58 ` [Bug target/52593] " rguenth at gcc dot gnu.org 2012-03-15 17:25 ` bugdal at aerifal dot cx [this message] 2012-03-15 20:21 ` dominiq at lps dot ens.fr 2012-03-16 2:24 ` bugdal at aerifal dot cx 2012-03-16 11:00 ` rguenth at gcc dot gnu.org 2012-03-16 14:49 ` bugdal at aerifal dot cx 2012-04-28 23:22 ` bugdal at aerifal dot cx 2012-04-29 0:17 ` joseph at codesourcery dot com 2012-04-29 1:22 ` bugdal at aerifal dot cx 2014-03-10 22:36 ` david.heidelberger at ixit dot cz
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-52593-4-enU7YEeTle@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).