CPROJ(3POSIX)
π PROLOG π
Okay bestie, real talk before we even get into it: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β so if you're on Linux, go peek at the corresponding Linux manual page for the actual tea π«. Orrrr the interface might not be implemented on Linux at all. Yeah. It's giving vibes uncertain. π
β¨ NAME β¨
cproj, cprojf, cprojl β the complex projection functions, aka the girls who take your chaotic infinity situation and give it ONE home π
π¦ SYNOPSIS π¦
#include <complex.h>
double complex cproj(double complex z);
float complex cprojf(float complex z);
long double complex cprojl(long double complex z);
πΈ DESCRIPTION πΈ
So the functionality on this reference page is aligned with the ISO C standard. If there's any conflict between what's written here and the ISO C standard, that's unintentional, okay? Not on purpose. This volume of POSIX.1β2017 defers to the ISO C standard, periodt.
Now the actual function tea β: these functions shall compute a projection of z onto the Riemann sphere. Here's the deal:
zprojects tozβ like, normally it's just itself, no drama π- except that all complex infinities (yes, even the ones with one infinite part and one NaN part) project to positive infinity on the real axis.
And if z has an infinite part, then cproj(z) shall be equivalent to:
INFINITY + I * copysign(0.0, cimag(z))
No cap, that's the whole formula. π
π RETURN VALUE π
These functions shall return the value of the projection onto the Riemann sphere. That's it, that's the return. Slay. β¨
π ERRORS π
No errors are defined. Not a single one. Iconic behavior honestly. π
The following sections are informative. (So like, cute to know, but not the law.)
π EXAMPLES π
None. β literally nothing here bestie, move along πΆβοΈ
π§ APPLICATION USAGE π§
None. β also empty, we're just vibing π
π RATIONALE π
Okay this part is actually so interesting, stay with me:
Two topologies are commonly used in complex mathematics:
- The complex plane with its continuum of infinities
- The Riemann sphere with its single infinity
The complex plane is better suited for transcendental functions, and the Riemann sphere is better suited for algebraic functions. Different functions, different homes, we don't pit them against each other π
The complex types with their multiplicity of infinities provide a useful (though imperfect) model for the complex plane. The cproj() function helps model the Riemann sphere by mapping all infinities to one, and it should be used just before any operation, especially comparisons, that might give spurious results for any of the other infinities. Like, clean up your infinities before you start comparing, okay? It's giving β¨prep workβ¨.
Note that a complex value with one infinite part and one NaN part is regarded as an infinity, not a NaN β because if one part is infinite, the complex value is infinite independent of the value of the other part. For the same reason, cabs() returns an infinity if its argument has an infinite part and a NaN part. π€―
π₯ FUTURE DIRECTIONS π₯
None. β the future is empty, live in the present, bestie π¦
π SEE ALSO π
carg()cimag()conj()creal()
Also! The Base Definitions volume of POSIX.1β2017, <complex.h> π
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
Okay that's the whole page, you made it, I'm so proud of you π«Ά This was brought to you by IEEE/The Open Group, circa 2017, and the page is literally named CPROJ(3POSIX). Go project some infinities, bestie. πβ¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms