[Bug math/13629] New: clog() returns wrong values around z=1
fxcoudert at gcc dot gnu.org
sourceware-bugzilla@sourceware.org
Fri Jan 27 14:12:00 GMT 2012
http://sourceware.org/bugzilla/show_bug.cgi?id=13629
Bug #: 13629
Summary: clog() returns wrong values around z=1
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: math
AssignedTo: aj@suse.de
ReportedBy: fxcoudert@gcc.gnu.org
Classification: Unclassified
On the example below, clog() is called on value 1+epsilon*I. The result (first
output line) is pretty different from the expected result, calculated in the
second output line as a second-order series expansion.
I could reproduce it with glibc versions 2.5, 2.11.2, and 2.13, on both i686
and x86_64 systems (and many compilers).
$ cat a.c
#include <math.h>
#include <complex.h>
#include <stdio.h>
int main ()
{
complex double z, fz,gz;
z = 1.0f + 0.00000001f*I;
fz = clog(z);
gz = (z-1) - (z-1)*(z-1)/2;
printf (" %.15e + %.15ei\n", creal(fz), cimag(fz));
printf (" %.15e + %.15ei\n", creal(gz), cimag(gz));
return 0;
}
$ gcc a.c -lm -O0 -W -Wall -std=c99 && ./a.out
0.000000000000000e+00 + 1.000000000000000e-08i
5.000000000000001e-17 + 1.000000000000000e-08i
--
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.
More information about the Glibc-bugs
mailing list