Namespaces
Variants
Views
Actions

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

From cppreference.com
< cpp‎ | numeric‎ | complex
(additional overloads return type correction)
m (Shorten template names. Use {{lc}} where appropriate.)
Line 1: Line 1:
 
{{cpp/title|real{{small|(std::complex)}}}}
 
{{cpp/title|real{{small|(std::complex)}}}}
 
{{cpp/numeric/complex/navbar}}
 
{{cpp/numeric/complex/navbar}}
{{ddcl list begin}}
+
{{dcl begin}}
{{ddcl list header | complex}}
+
{{dcl header | complex}}
{{ddcl list item | num=1 | 1=
+
{{dcl | num=1 | 1=
 
template< class T >  
 
template< class T >  
 
T real( const complex<T>& z );
 
T real( const complex<T>& z );
 
}}
 
}}
{{ddcl list item | num=2 | notes={{mark since c++11}} | 1=
+
{{dcl | num=2 | notes={{mark since c++11}} | 1=
 
long double real( long double z );
 
long double real( long double z );
 
}}
 
}}
{{ddcl list item | num=3 | notes={{mark since c++11}} | 1=
+
{{dcl | num=3 | notes={{mark since c++11}} | 1=
 
template< class DoubleOrIngeter >
 
template< class DoubleOrIngeter >
 
double real( DoubleOrInteger z );
 
double real( DoubleOrInteger z );
 
}}
 
}}
{{ddcl list item | num=4 | notes={{mark since c++11}} | 1=
+
{{dcl | num=4 | notes={{mark since c++11}} | 1=
 
float real( float z );
 
float real( float z );
 
}}
 
}}
{{ddcl list end}}
+
{{dcl end}}
  
 
Returns the real component of the complex number {{tt|z}}, i.e. {{c|z.real()}}.
 
Returns the real component of the complex number {{tt|z}}, i.e. {{c|z.real()}}.
Line 24: Line 24:
  
 
===Parameters===
 
===Parameters===
{{param list begin}}
+
{{par begin}}
{{param list item | z | complex value}}
+
{{par | z | complex value}}
{{param list end}}
+
{{par end}}
  
 
===Return value===
 
===Return value===
Line 33: Line 33:
  
 
===See also===
 
===See also===
{{dcl list begin}}
+
{{dsc begin}}
{{dcl list template | cpp/numeric/complex/dcl list real}}
+
{{dsc inc | cpp/numeric/complex/dcl list real}}
{{dcl list template | cpp/numeric/complex/dcl list imag}}
+
{{dsc inc | cpp/numeric/complex/dcl list imag}}
{{dcl list template | cpp/numeric/complex/dcl list imag2}}
+
{{dsc inc | cpp/numeric/complex/dcl list imag2}}
{{dcl list end}}
+
{{dsc end}}
  
 
[[de:cpp/numeric/complex/real2]]
 
[[de:cpp/numeric/complex/real2]]

Revision as of 19:18, 31 May 2013

 
 
 
 
Defined in header <complex>
template< class T >
T real( const complex<T>& z );
(1)
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().

(since C++11)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 real component of z

See also

Template:cpp/numeric/complex/dcl list realTemplate:cpp/numeric/complex/dcl list imagTemplate:cpp/numeric/complex/dcl list imag2