public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "JoshuaHopp at web dot de" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug math/14759] New: Most functions in math.h not correctly rounded
Date: Wed, 24 Oct 2012 08:08:00 -0000	[thread overview]
Message-ID: <bug-14759-131@http.sourceware.org/bugzilla/> (raw)

http://sourceware.org/bugzilla/show_bug.cgi?id=14759

             Bug #: 14759
           Summary: Most functions in math.h not correctly rounded
           Product: glibc
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: unassigned@sourceware.org
        ReportedBy: JoshuaHopp@web.de
    Classification: Unclassified
              Host: x86_64
            Target: x86_64
             Build: linux-gnu


Most functions in math.h do not use correct rounding. Example:

//--- snip ---
#include <math.h>
#include <fenv.h>
#include <assert.h>

int main() {
        double x = 1.0; // 1.0 is exact

        fesetround(FE_DOWNWARD);
        double a = asin(x);
        fesetround(FE_UPWARD);
        double b = asin(x);

        // asin(1) == pi/2, which is not exactly representable
        // so, assuming correct rounding, a should be less than b
        assert(a < b);
}
//--- snap ---

Compile with "gcc -lm" (or even "gcc -lm -ffloat-store -frounding-math").

Run the example:
 main: Assertion `a < b' failed.

Similar results can be obtained with exp, cos, acos, atan, sinh, cosh, atanh,
asinh and acosh.

------
Kernel version: 3.5.2-1.fc17
gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC) 
GNU ld version 2.22.52.0.1-10.fc17 20120131

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


             reply	other threads:[~2012-10-24  8:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-24  8:08 JoshuaHopp at web dot de [this message]
2012-10-24 12:39 ` [Bug math/14759] " jsm28 at gcc dot gnu.org
2012-10-24 12:42 ` jsm28 at gcc dot gnu.org
2012-10-24 12:44 ` jsm28 at gcc dot gnu.org
2012-10-24 12:44 ` jsm28 at gcc dot gnu.org
2013-08-27  7:58 ` bagnara at cs dot unipr.it
2013-11-28 22:38 ` jsm28 at gcc dot gnu.org
2014-01-29 16:35 ` jsm28 at gcc dot gnu.org
2014-06-14 11:18 ` fweimer at redhat 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-14759-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /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: link
Be 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).