This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/14473] New: Inaccurate CPOWF function on x86_32 and x86_64
- From: "liubov.dmitrieva at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Wed, 15 Aug 2012 15:09:46 +0000
- Subject: [Bug math/14473] New: Inaccurate CPOWF function on x86_32 and x86_64
- Auto-submitted: auto-generated
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.