public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vincent at vinc17 dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/43419] New: gcc replaces pow(x, 0.5) by sqrt(x), invalid when x is -0 Date: Thu, 18 Mar 2010 14:08:00 -0000 [thread overview] Message-ID: <bug-43419-6373@http.gcc.gnu.org/bugzilla/> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 931 bytes --] gcc replaces pow(x, 0.5) by sqrt(x). This is invalid when x is -0. Indeed, according to ISO C99 (N1256), F.9.4.4: pow(±0, y) returns +0 for y > 0 and not an odd integer. So, pow(-0.0, 0.5) should return +0. But sqrt(-0.0) should return -0 according to the IEEE 754 standard (and F.9.4.5 from ISO C99). Testcase: #include <stdio.h> #include <math.h> int main (void) { volatile double x = -0.0; printf ("sqrt(-0) = %g\n", sqrt (x)); printf ("pow(-0,0.5) = %g\n", pow (x, 0.5)); return 0; } -- Summary: gcc replaces pow(x, 0.5) by sqrt(x), invalid when x is - 0 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vincent at vinc17 dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43419
next reply other threads:[~2010-03-18 14:08 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-03-18 14:08 vincent at vinc17 dot org [this message] 2010-03-18 14:33 ` [Bug middle-end/43419] " vincent at vinc17 dot org 2010-03-18 14:35 ` matz at gcc dot gnu dot org 2010-03-18 14:42 ` dominiq at lps dot ens dot fr 2010-03-18 14:49 ` matz at gcc dot gnu dot org 2010-03-18 15:31 ` rguenth at gcc dot gnu dot org 2010-03-18 16:08 ` matz at gcc dot gnu dot org 2010-03-18 16:48 ` matz at gcc dot gnu dot org 2010-03-22 14:58 ` jakub at gcc dot gnu dot org 2010-03-22 16:02 ` mikpe at it dot uu dot se 2010-03-25 16:18 ` hjl dot tools at gmail 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-43419-6373@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).