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/14473] Inaccurate CPOWF function on x86_32 and x86_64


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

--- Comment #2 from Liubov Dmitrieva <liubov.dmitrieva at gmail dot com> 2012-08-16 07:51:45 UTC ---
Reformatted test case:

#include <stdio.h>
#include <math.h>
#include <complex.h>
#include <fenv.h>

#define  real(a)    (((float*)&(a))[0])
#define  imag(a)    (((float*)&(a))[1])

int main() {
    float  _Complex a,b,r1;
    double _Complex r2;

    a=-0x1.1c71c8p-1 + I * -0x1.c71c7cp-4; //argument
    b= 0x1.1c71c6p-1 + I * -0x1.c71c7cp-4; //argument

    fesetround(FE_TONEAREST);

    r1 = cpowf(a,b);  //actual result
    r2 = cpow(a,b);   //actual result 2

    printf("inputs: a = %15.6a + I * %15.6a\n", creal(a), cimag(a));
    printf("        b = %15.6a + I * %15.6a\n", creal(b), cimag(b));
    printf("actual    = %15.6a + I * %15.6a\n", creal(r1),cimag(r1));
    printf("expected  = %15.6a + I * %15.6a\n", creal(r2),cimag(r2));
    printf("error     = %15f + I * %15f ulp\n", fabs(creal(r1) - creal(r2)) *
exp2(23.0-logbf(creal(r1))),
                                                fabs(cimag(r1) - cimag(r2)) *
exp2(23.0-logbf(cimag(r1))) );
    return 0;
}


Results (same x86 and x86_64)

inputs: a =  -0x1.1c71c8p-1 + I *  -0x1.c71c7cp-4
        b =   0x1.1c71c6p-1 + I *  -0x1.c71c7cp-4
actual    = -0x1.df1246p-11 + I *  -0x1.0d38dap-1
expected  = -0x1.df1aefp-11 + I *  -0x1.0d38d9p-1
error     =  1108.410103 + I *  0.495932 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]