#include "libm.h"
-// nice, but internally ugly:
-// macros generate gratuitous code the compiler has to optimize away
double complex conj(double complex z)
{
return cpack(creal(z), -cimag(z));
}
-
-/*
-// always works, but ugly union
-double complex conj(double complex z) {
- union dcomplex u = {z};
-
- u.a[1] = -u.a[1];
- return u.z;
-}
-
-// reasonable, needs clever compiler that understands *I
-double complex conj(double complex z) {
- return creal(z) - cimag(z)*I;
-}
-*/