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:

  • z projects to z β€” 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:

  1. The complex plane with its continuum of infinities
  2. 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> πŸ’–


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. πŸ’–βœ¨