blob: d2db8af08817750aa5ddc61d9c26dce1f064887b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include "__complex.h" // for IMAG_PART, REAL_PART, double_complex
#include <complex.h> // for cimag, complex, cproj, creal
#include <math.h> // for copysign, isinf, INFINITY
double complex cproj(double complex z)
{
double_complex w = { .z = z };
if (isinf(creal(z)) || isinf(cimag(z))) {
REAL_PART(w) = (double)INFINITY;
IMAG_PART(w) = copysign(0.0, cimag(z));
}
return (w.z);
}
|