##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::real(std::complex)

From cppreference.com
< cpp‎ | numeric‎ | complex

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 DoubleOrInteger > 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)

### [edit] Parameters

z | - | complex value

### [edit] Return value

the real component of `z`

### [edit] See also

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

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/numeric/complex/real2&oldid=79224"