This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/14759] New: Most functions in math.h not correctly rounded


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]