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/14472] New: Inaccurate y1f function on x86_32


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

             Bug #: 14472
           Summary: Inaccurate y1f function on x86_32
           Product: glibc
           Version: 2.17
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: unassigned@sourceware.org
        ReportedBy: liubov.dmitrieva@gmail.com
    Classification: Unclassified


// gcc main.c -std=c99 -lm -m32

#include <stdio.h>
#include <fenv.h>
#include <stdlib.h>  // abs function for int argument

extern float y1f(float);
extern double y1(double);

#define i32(a)    (((int*)&(a))[0])

int main() {
    float a,r1,r2;

    i32(a)=0x422cc0bc;    //argument

    fesetround(FE_TONEAREST); // FE_TONEAREST

    r1 = y1f(a);  //actual result
    r2 = y1(a);   //actual result 2

    printf("inputs: a = (0x%08x)\t%e\n", i32(a), a);
    printf("actual    = (0x%08x)\t%.13e\n", i32(r1), r1);
    printf("expected  = (0x%08x)\t%.13e\n", i32(r2), r2);
    printf("error     = %d ulp\n", abs(i32(r1) - i32(r2)));

    return 0;
}

Result:

inputs: a = (0x422cc0bc)        4.318822e+01
actual    = (0x33f3b02b)        1.1347614048418e-07
expected  = (0x33f3934c)        1.1342362427058e-07
error     = 7391 ulp

-- 
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]