public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/14759] New: Most functions in math.h not correctly rounded
@ 2012-10-24  8:08 JoshuaHopp at web dot de
  2012-10-24 12:39 ` [Bug math/14759] " jsm28 at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: JoshuaHopp at web dot de @ 2012-10-24  8:08 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-06-14 11:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-24  8:08 [Bug math/14759] New: Most functions in math.h not correctly rounded JoshuaHopp at web dot de
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

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).