Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/complex/real2"

From cppreference.com
< cpp‎ | numeric‎ | complex
(c++14 constexpr, revbox)
m (+link to C documentation, -link to imag)
Line 41: Line 41:
 
{{dsc begin}}
 
{{dsc begin}}
 
{{dsc inc | cpp/numeric/complex/dsc real}}
 
{{dsc inc | cpp/numeric/complex/dsc real}}
{{dsc inc | cpp/numeric/complex/dsc imag}}
 
 
{{dsc inc | cpp/numeric/complex/dsc imag2}}
 
{{dsc inc | cpp/numeric/complex/dsc imag2}}
 +
{{dsc see c | c/numeric/complex/creal}}
 
{{dsc end}}
 
{{dsc end}}
  

Revision as of 14:06, 14 June 2014

 
 
 
 
Defined in header <complex>
template< class T >
T real( const complex<T>& z );
(1) (until C++14)
template< class T >
constexpr T real( const complex<T>& z );
(1) (since C++14)
long double real( long double z );
(2) (since C++11)
template< class DoubleOrIngeter >
double real( DoubleOrInteger z );
(3) (since C++11)
float real( float z );
(4) (since C++11)

Returns the real component of the complex number z, i.e. z.real().

Additional overloads are provided for float, double, long double, and all integer types, which are treated as complex numbers with zero imaginary component.(since C++11)

Parameters

z - complex value

Return value

the real component of z

See also

accesses the real part of the complex number
(public member function) [edit]
returns the imaginary part
(function template) [edit]
C documentation for creal