From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/numeric%2Fcomplex%2Fcproj.html | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 devdocs/c/numeric%2Fcomplex%2Fcproj.html (limited to 'devdocs/c/numeric%2Fcomplex%2Fcproj.html') diff --git a/devdocs/c/numeric%2Fcomplex%2Fcproj.html b/devdocs/c/numeric%2Fcomplex%2Fcproj.html new file mode 100644 index 00000000..f74622ea --- /dev/null +++ b/devdocs/c/numeric%2Fcomplex%2Fcproj.html @@ -0,0 +1,49 @@ +

cprojf, cproj, cprojl

Defined in header <complex.h>
float complex       cprojf( float complex z );
+
(1) (since C99)
double complex      cproj( double complex z );
+
(2) (since C99)
long double complex cprojl( long double complex z );
+
(3) (since C99)
Defined in header <tgmath.h>
#define cproj( z )
+
(4) (since C99)
+1-3) Computes the projection of z on the Riemann sphere.
+4) Type-generic macro: if z has type long double complex, long double imaginary, or long double, cprojl is called. If z has type float complex, float imaginary, or float, cprojf is called. If z has type double complex, double imaginary, double, or any integer type, cproj is called.

For most z, cproj(z)==z, but all complex infinities, even the numbers where one component is infinite and the other is NaN, become positive real infinity, INFINITY+0.0*I or INFINITY-0.0*I. The sign of the imaginary (zero) component is the sign of cimag(z).

+

Parameters

+ +
z - complex argument

Return value

The projection of z on the Riemann sphere.

+

This function is fully specified for all possible inputs and is not subject to any errors described in math_errhandling

+

Notes

The cproj function helps model the Riemann sphere by mapping all infinities to one (give or take the sign of the imaginary zero), and should be used just before any operation, especially comparisons, that might give spurious results for any of the other infinities.

+

Example

#include <stdio.h>
+#include <complex.h>
+#include <math.h>
+ 
+int main(void)
+{
+    double complex z1 = cproj(1 + 2*I);
+    printf("cproj(1+2i) = %.1f%+.1fi\n", creal(z1),cimag(z1));
+ 
+    double complex z2 = cproj(INFINITY+2.0*I);
+    printf("cproj(Inf+2i) = %.1f%+.1fi\n", creal(z2),cimag(z2));
+ 
+    double complex z3 = cproj(INFINITY-2.0*I);
+    printf("cproj(Inf-2i) = %.1f%+.1fi\n", creal(z3),cimag(z3));
+}

Output:

+
cproj(1+2i) = 1.0+2.0i
+cproj(Inf+2i) = inf+0.0i
+cproj(Inf-2i) = inf-0.0i

References

See also

+
C++ documentation for proj
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/numeric/complex/cproj +

+
-- cgit v1.2.3