X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f From: Kbwms AT aol DOT com Message-ID: <9e.270a723e.2fc3774c@aol.com> Date: Mon, 23 May 2005 14:13:32 EDT Subject: Fwd: Problem with Complex To: djgpp-workers AT delorie DOT com MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="part1_9e.270a723e.2fc3774c_boundary" X-Mailer: 8.0 for Windows sub 6033 Reply-To: djgpp-workers AT delorie DOT com --part1_9e.270a723e.2fc3774c_boundary Content-Type: multipart/alternative; boundary="part1_9e.270a723e.2fc3774c_alt_boundary" --part1_9e.270a723e.2fc3774c_alt_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit This problem vanished with GCC 4.0.0. KB Williams --part1_9e.270a723e.2fc3774c_alt_boundary Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable This problem vanished with GCC 4.0.0.=

KB Williams
--part1_9e.270a723e.2fc3774c_alt_boundary-- --part1_9e.270a723e.2fc3774c_boundary Content-Type: message/rfc822 Content-Disposition: inline Return-path: From: Kbwms AT aol DOT com Full-name: Kbwms Message-ID: <81 DOT 27bd980d DOT 2fba1936 AT aol DOT com> Date: Mon, 16 May 2005 11:41:42 EDT Subject: Problem with Complex To: djgpp-workers AT delorie DOT com MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="part2_9e.270a723e.2fba1936_boundary" X-Mailer: 8.0 for Windows sub 6033 --part2_9e.270a723e.2fba1936_boundary Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable I'm having trouble understanding a problem when using complex stuff. =A0 Whe= n I=20 have a complex quantity set to HUGE_VAL + HUGE_VAL * I and I try to take the= =20 real part, the result is NaN. Recall, HUGE_VAL =3D Inf. Below is the output from a tiny program that illustrates the problem. =A0 Th= e=20 tiny program is included followed by function creal(complex double). Am I having a problem with gcc 3.4.3? KB Williams =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D HUGE_VAL =3D Inf Setting complex double XX =3D HUGE_VAL + HUGE_VAL * I Setting double AA =3D creal(XX); AA =3D NaN #include "complex.h" #include #include #include int main(void) { =A0=A0=A0 double=A0 AA; =A0=A0=A0 complex double XX; =A0=A0=A0 printf("HUGE_VAL =3D %lg\n", HUGE_VAL); =A0=A0=A0 printf("Setting complex double XX =3D HUGE_VAL + HUGE_VAL * I\n"); =A0=A0=A0 XX =3D HUGE_VAL + HUGE_VAL * I; =A0=A0=A0 printf("Setting double AA =3D creal(XX); AA =3D %lg\n", AA =3D cre= al(XX)); exit(0); } #include double creal(double complex z) { =A0=A0=A0 return __real__ z; } --part2_9e.270a723e.2fba1936_boundary Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable I'm having trouble understanding a pr= oblem when using complex stuff. =A0 When I have a complex quantity set to HU= GE_VAL + HUGE_VAL * I and I try to take the real part, the result is NaN.&nb= sp; Recall, HUGE_VAL =3D Inf.

Below is the output from a tiny program that illustrates the problem. =A0 Th= e tiny program is included followed by function creal(complex double).

Am I having a problem with gcc 3.4.3?


KB Williams
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
HUGE_VAL =3D Inf
Setting complex double XX =3D HUGE_VAL + HUGE_VAL * I
Setting double AA =3D creal(XX); AA =3D NaN

#include "complex.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
=A0=A0=A0 double=A0 AA;
=A0=A0=A0 complex double XX;

=A0=A0=A0 printf("HUGE_VAL =3D %lg\n", HUGE_VAL);
=A0=A0=A0 printf("Setting complex double XX =3D HUGE_VAL + HUGE_VAL * I\n");=
=A0=A0=A0 XX =3D HUGE_VAL + HUGE_VAL * I;
=A0=A0=A0 printf("Setting double AA =3D creal(XX); AA =3D %lg\n", AA =3D cre= al(XX));
exit(0);
}

#include <complex.h>

double
creal(double complex z)
{
=A0=A0=A0 return __real__ z;
}

--part2_9e.270a723e.2fba1936_boundary-- --part1_9e.270a723e.2fc3774c_boundary--