This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: About the GCC
Am Donnerstag, 27. April 2006 14:55 schrieb Andrew Haley:
> > Now as you say it, I thought I remembered a "complex" type gcc extension
> > as well, but couldn't find it either.
>
> TFM! :-)
>
> 5.9 Complex Numbers
Right, I fired too fast and just stumbled over this now, sorry. Here a short
example:
#include <stdio.h>
int main() {
_Complex double x = 2.5j + 1;
_Complex double y = -2.5j + 1;
printf("x = %f %fj\n", __real__ x, __imag__ x);
printf("y = %f %fj\n", __real__ y, __imag__ y);
_Complex double xy = x * y;
printf("x * y = %f %fj\n", __real__ xy, __imag__ xy);
_Complex double conj_x = ~x;
printf("complex conjugation of x = %f %fj\n", __real__ conj_x, __imag__
conj_x);
}
Actually a quite nice extension.
CU
Christian