cprojf Function

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

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




float complex cprojf(float complex z);


value for which to calculate the projection

Return Value

Returns the a projection of a single 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.


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)
  float complex x;

  x = -INFINITY + 1.0*I;
  y = cprojf(x);
  printf("The Riemann plane projection of %f + %fi is %f + %fi\n", crealf(x), cimagf(x), crealf(y), cimagf(y));

Example Output

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