public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/14473] New: Inaccurate CPOWF  function on x86_32 and x86_64
@ 2012-08-15 15:10 liubov.dmitrieva at gmail dot com
  2012-08-15 15:23 ` [Bug math/14473] " joseph at codesourcery dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: liubov.dmitrieva at gmail dot com @ 2012-08-15 15:10 UTC (permalink / raw)
  To: glibc-bugs

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

             Bug #: 14473
           Summary: Inaccurate CPOWF  function on x86_32 and x86_64
           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 <math.h>
#include <complex.h>
#include <fenv.h>
#include <stdlib.h>  // abs function for int argument

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

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

    ireal(a)=0xbf0e38e4;    iimag(a)=0xbde38e3e;    //argument
    ireal(b)=0x3f0e38e3;    iimag(b)=0xbde38e3e;    //argument

    fesetround(FE_TONEAREST);

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

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

    return 0;
}

Result x86_32 (core2):

inputs: a.real = (0xbf0e38e4)   -5.555556e-01
        a.imag = (0xbde38e3e)   -1.111111e-01

inputs: b.real = (0x3f0e38e3)   5.555555e-01
        b.imag = (0xbde38e3e)   -1.111111e-01

actual.real    = (0xba6f8923)   -9.1375614283606e-04
expected.real  = (0xba6f8d77)   -9.1382063692436e-04
error.real     = 1108 ulp

actual.imag    = (0xbf069c6d)   -5.2582436800003e-01
expected.imag  = (0xbf069c6d)   -5.2582436800003e-01
error.imag     = 0 ulp


Result x86_64 (core2):

inputs: a.real = (0xbf0e38e4)   -5.555556e-01
        a.imag = (0xbde38e3e)   -1.111111e-01

inputs: b.real = (0x3f0e38e3)   5.555555e-01
        b.imag = (0xbde38e3e)   -1.111111e-01

actual.real    = (0xba6f8923)   -9.1375614283606e-04
expected.real  = (0xba6f8d77)   -9.1382063692436e-04
error.real     = 1108 ulp

actual.imag    = (0xbf069c6d)   -5.2582436800003e-01
expected.imag  = (0xbf069c6d)   -5.2582436800003e-01
error.imag     = 0 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.


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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-15 15:10 [Bug math/14473] New: Inaccurate CPOWF function on x86_32 and x86_64 liubov.dmitrieva at gmail dot com
2012-08-15 15:23 ` [Bug math/14473] " joseph at codesourcery dot com
2012-08-16  7:52 ` liubov.dmitrieva at gmail dot com
2013-01-25 16:49 ` glisse at gcc dot gnu.org
2013-04-04 16:12 ` [Bug math/14473] Inaccurate CPOW* function on all machines carlos at redhat dot com
2013-04-04 16:13 ` carlos at redhat dot com
2013-08-05 19:27 ` licquia at linuxfoundation dot org
2013-12-06 14:07 ` mwelinder at gmail dot com
2013-12-06 14:17 ` mwelinder at gmail dot com
2014-06-17 18:38 ` 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).