std::proj(std::complex) (3) - Linux Manuals
std::proj(std::complex): std::proj(std::complex)
NAME
std::proj(std::complex) - std::proj(std::complex)
Synopsis
Defined in header <complex>
template< class T > (1) (since C++11)
complex<T> proj( const complex<T>& z );
std::complex<long double> proj( long double z ); (2) (since C++11)
template< class DoubleOrInteger > (3) (since C++11)
std::complex<double> proj( DoubleOrInteger z );
std::complex<float> proj( float z ); (4) (since C++11)
Returns the projection of the complex number z onto the Riemann sphere.
For most z, std::proj(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) or (INFINITY, -0). The sign of the imaginary (zero) component is the sign of std::imag(z).
Additional overloads are provided for float, double, long double, and all integer types, which are treated as complex numbers with zero imaginary component.
Parameters
z - complex value
Return value
the projection of z onto the Riemann sphere
Notes
The proj 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
// Run this code
Output:
See also
abs(std::complex) (function template)
norm (function template)
polar (function template)