# std::imag(std::complex)

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

Defined in header `<complex>` |  |
| (1) |
template< class T > T imag( const std::complex <T>& z ); |  | (until C++14)
template< class T > constexpr T imag( const std::complex <T>& z ); |  | (since C++14)
| (2) |
float imag( float z ); template< class DoubleOrInteger > double imag( DoubleOrInteger z ); long double imag( long double z ); |  | (since C++11) (until C++14)
constexpr float imag( float z ); template< class DoubleOrInteger > constexpr double imag( DoubleOrInteger z ); constexpr long double imag( long double z ); |  | (since C++14)

1) Returns the imaginary component of the complex number `z`, i.e. z.imag().

2) 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 imaginary component of `z`

### See also

imag | accesses the imaginary part of the complex number (public member function)
real | returns the real component (function template)

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/complex/imag2&oldid=97380"