public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "liubov.dmitrieva at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug math/14473] New: Inaccurate CPOWF  function on x86_32 and x86_64
Date: Wed, 15 Aug 2012 15:10:00 -0000	[thread overview]
Message-ID: <bug-14473-131@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-08-15 15:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15 15:10 liubov.dmitrieva at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14473-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).