# cproj Function

Calculates the a projection of a double precision complex value onto the Riemann sphere.

Attention: This function is implemented only by MPLAB XC32 C compilers.

Include

<complex.h>

Prototype

double complex cproj(double complex z);

Argument

 z value for which to calculate the projection

Return Value

Returns the a projection of a double precision complex value, z, onto the Riemann sphere. The projection is such that z is returned, except if z is any complex infinity, in which case a positive infinity is returned.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <stdio.h>
#include <complex.h>
#include <math.h>

int main(void)
{
double complex x;

x = -INFINITY + 1.0*I;
y = cproj(x);
printf("The Riemann plane projection of %f + %fi is %f + %fi\n", creal(x), cimag(x), creal(y), cimag(y));
}

Example Output

The Riemann plane projection of -inf + 1.000000i is inf + 0.000000i