std::real(std::complex)

std::real(std::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).

Parameters

z - complex value

Return value

the real component of z.

See also

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

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/numeric/complex/real2

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部