Previous Page
Next Page

cproj

Calculates the projection of a complex number on the Riemann sphere

#include <complex.h>
double complex cproj ( double complex z  );
float complex cprojf ( float complex z  );
long double complex cprojl ( long double complex z  );

The Riemann sphere is a surface that represents the entire complex plane and one point for infinity. The cproj( ) function yields the representation of a complex number on the Riemann sphere. The value of cproj(z) is equal to z, except in cases where the real or complex part of z is infinite. In all such cases, the real part of the result is infinity, and the imaginary part is zero with the sign of the imaginary part of the argument z.

Example

double complex z = -INFINITY - 2.7 * I;

double complex c = cproj(z);
printf("%.2f %+.2f * I is projected to %.2f %+.2f * I.\n",
       creal(z), cimag(z), creal(c), cimag(c));

This code produces the following output:

-inf -2.70 * I is projected to inf -0.00 * I.

See Also

cabs( ), cimag( ), creal( ), carg( ), conj( )


Previous Page
Next Page