A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/complex/proj/ below:

function template

<complex>

std::proj complex (1)
template<class T> complex<T> proj (const complex<T>& x);
complex (1)
template<class T> complex<T> proj (const complex<T>& x);
arithmetic type (2)
complex<double> conj (ArithmeticType x);

Complex projection.

Returns the projection of the complex number x onto the Riemann sphere.

The projection of x is x, except for complex infinities, which are mapped to the complex value with a real component of INFINITY and an imaginary component of 0.0 or -0.0 (where supported), depending on the sign of the imaginary component of x.

Additional overloads are provided for arguments of any fundamental arithmetic type: In this case, the function assumes the value has a zero imaginary component.


The return type is complex<double>, except if the argument is float or long double (in which case, the return type is the complex instantiation for that type: either complex<float> or complex<long double>).

Parameters
x
Complex value.

Return value Complex projection of x onto the Riemann sphere.

Example
1
2
3
4
5
6
7
8
9
10
11
12
13
// proj example
#include <iostream>     // std::cout
#include <complex>      // std::complex, std::proj
#include <limits>       // std::numeric_limits

int main ()
{
  std::complex<double> mycomplex (std::numeric_limits<double>::infinity(),2.0);

  std::cout << "The projection of " << mycomplex << " is " << std::proj(mycomplex) << '\n';

  return 0;
}

Possible output (representation of infinities may vary):
The projection of (inf,2) is (inf,0)


See also
conj
Complex conjugate (function template)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4