This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem with <tgmath.h>


I hope I'm posting this to the correct list. (bug-glibc appears to be
dead, and anyway I'm not sure that this is a bug and not just me
misunderstanding how things are supposed to work).

I'm having trouble using tgmath.h. Here's an example. I try to print
exp[-I pi/2], which should of course be -I. Instead I get a compiler
warning, and 0 at runtime. The programme works fine if I replace tgmath.h
by complex.h. The same problem occurs with gcc and also intel icc v8.0.
I'm using glibc-2.3.2.

[lsb32@bulldoga lsb32]$ cat p.c
#include <stdio.h>
#include <tgmath.h>
int main()
{
        complex double q=cpow(2.718281828,-1.570796327I);
        printf("(%f %f)\n",creal(q),cimag(q));
        return 0;
}
[lsb32@bulldoga lsb32]$ gcc -Wall p.c -lm
p.c: In function `main':
p.c:6: warning: double format, complex double arg (arg 2)
p.c:6: warning: double format, complex double arg (arg 3)
[lsb32@bulldoga lsb32]$ ./a.out
(0.000000 0.000000)

[lsb32@bulldoga lsb32]$ uname -a
Linux bulldoga.wss.yale.edu 2.4.20-31.9smp #1 SMP Tue Apr 13 17:40:10 EDT 
2004 i686 i686 i386 GNU/Linux
[lsb32@bulldoga lsb32]$ gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.



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