This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C version of single precision complex problem


This is a C example to complement the Fortran example in the thread "single
precision complex bug in g77 - was Testing g77 with LAPACK 3.0"
####################################################################
/*
 * complex6.c 
 * 
 * On 64 bit machines gcc tries to store real and imaginary parts 
 * of 32 bit floats in one register.
 * Under Irix6.5, we get:
 *        egcs-1.1.2                realpart(2.0+1.0fi) = 0.0
 *        egcs-2.95 (after 19990715)   Compile time error 
 *
 * David Billinghurst (David.Billinghurst@riotinto.com.au
 * 27 July 1999
 */

float  
realpart( __complex__ float c)
{
  return __real__ c;
}

int 
main(int argc, char *argv[])
{
 float ra = 2.0, rb = 1.0;
  __complex__ float a = ra + rb*1.0fi;
  float b = realpart(a);
  if ( b != ra ) 
    abort();
  return (0);
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]