blob: a04de5cce1c10b3dcc6d5c648e8842f2604a5cf8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include "__complex.h" // for IMAG_PART, REAL_PART, float_complex
#include <complex.h> // for cimagf, complex, cprojf, crealf
#include <math.h> // for copysignf, isinf, INFINITY
float complex cprojf(float complex z)
{
float_complex w = { .z = z };
if (isinf(crealf(z)) || isinf(cimagf(z))) {
REAL_PART(w) = INFINITY;
IMAG_PART(w) = copysignf(0.0, cimagf(z));
}
return w.z;
}
|