Bug 5490 - cimagf gives incorrect results
Summary: cimagf gives incorrect results
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Andreas Jaeger
Depends on:
Reported: 2007-12-17 00:26 UTC by Ismail "cartman" Donmez
Modified: 2014-07-03 11:48 UTC (History)
1 user (show)

See Also:
Host: i686-gnu-linux
Last reconfirmed:
fweimer: security-


Note You need to log in before you can comment on or make changes to this bug.
Description Ismail "cartman" Donmez 2007-12-17 00:26:17 UTC
This is a stripped down testcase from gfortran testcases converted to C :

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

int main() {
  float complex volatile z, one;
  z   = 5.0;
  one = 1.0;
  z   = cpowf (z, one);
  printf("%f\n", (double)cimagf(z));
  return 0;

prints -0.000141 with libc 2.7 where as it prins 0.000000 with libc 2.3.6 and
libc 2.4.11 on i686 host.
Comment 1 Ismail "cartman" Donmez 2007-12-17 00:41:11 UTC
Possibly a related problem:

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

int main() {
  float complex volatile z;
  z   = 1.2 - 4.0*I;
  z   = clogf(z);
  printf("%lf\n", cimagf(z));
  return 0;

prints -0.000029 instead of -1.2793396 .
Comment 2 Ismail "cartman" Donmez 2007-12-17 19:21:56 UTC
-> Assign to math component
Comment 3 Ismail "cartman" Donmez 2007-12-18 14:47:44 UTC
math regression tests fail hence this is likely a gcc 4.3 problem instead.
Closing as Invalid.