template< class T >
T abs( const complex<T>& z );
Returns the magnitude of the complex number z.
[edit] Parameters [edit] Return valueIf 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)).
[edit] Example#include <complex> #include <iostream> int main() { std::complex<double> z(1, 1); std::cout << z << " cartesian is rho = " << std::abs(z) << " theta = " << std::arg(z) << " polar\n"; }
Output:
(1,1) cartesian is rho = 1.41421 theta = 0.785398 polar[edit] See also returns the phase angle
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4