std::abs(std::complex) (3) - Linux Manuals
std::abs(std::complex): std::abs(std::complex)
NAME
std::abs(std::complex) - std::abs(std::complex)
Synopsis
Defined in header <complex>
template< class T >
T abs( const complex<T>& z );
Returns the magnitude of the complex number z.
Parameters
z - complex value
Return value
If no errors occur, returns the absolute value (also known as norm, modulus, or magnitude) of z.
Errors and special cases are handled as if the function is implemented as std::hypot(std::real(z), std::imag(z))
Examples
// Run this code
Output:
See also
arg (function template)
polar (function template)
abs(int)
labs
llabs computes absolute value of an integral value (|x|)
(C++11)
abs(float)
fabs
fabsf
fabsl absolute value of a floating point value (|x|)
(C++11)
(C++11)
hypot computes square root of the sum of the squares of two given numbers (
hypotf √
hypotl x2
(C++11) )
(C++11) (function)
(C++11)
abs(std::valarray) (function template)