Article View: gnu.gcc.bug
Article #6093No warnings when passing complex to real functions
From: Wayne Hayes
Date: Tue, 26 Nov 1996 00:00
Date: Tue, 26 Nov 1996 00:00
22 lines
1005 bytes
1005 bytes
This should fail with an error; or at the very least, print a warning:
$ cat foo.c
#include <stdio.h>
#include <math.h>
int main()
{
__complex__ z = 1.0i;
printf ("exp(%gi) = %g + %gi\n", __imag__ z,
__real__ exp(z), __imag__ exp(z));
return 0;
}
$ gcc -Wall foo.c -lm
$ ./a.out
exp(1i) = 1 + 0i
It appears that exp() (and sin()) just take the real part of it's argument,
ignoring the imaginary part.
Technical Details
Message-ID:
<96Nov26.155726edt.4175-23225@church.cs.toronto.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,e8c0f6f13cf0bf4e,start X-Google-Attributes: gid113d02,public From: wayne@cs.toronto.edu (Wayne Hayes) Subject: No warnings when passing complex to real functions Date: 1996/11/26 Message-ID: <96Nov26.155726edt.4175-23225@church.cs.toronto.edu> X-Deja-AN: 200925521 sender: bug-gcc-request@prep.ai.mit.edu x-nntp-posting-host: yonge.cs.toronto.edu x-gateway: relay3.UU.NET from bug-gcc to gnu.gcc.bug; Tue, 26 Nov 1996 18:14:02 EST newsgroups: gnu.gcc.bug originator: root@yonge.cs.toronto.edu