##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::norm(std::complex)

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

Defined in header `<complex>` |  |
template< class T > T norm( const complex<T>& z ); | (1) |
long double norm( long double z ); | (2) | (since C++11)
template< class DoubleOrInteger > double norm( DoubleOrInteger z ); | (3) | (since C++11)
float norm( float z ); | (4) | (since C++11)

Returns the squared magnitude of the complex number `z`.

(since C++11)Additional overloads are provided for float, double, long double, and all integer types, which are treated as complex numbers with zero imaginary component.

### [edit] Parameters

z | - | complex value

### [edit] Return value

the squared magnitude of `z`

### [edit] Notes

The norm calculated by this function is also known as field norm or absolute square.

The Euclidean norm of a complex number is provided by `std::abs`, which is more costly to compute. In some situations, it may be replaced by `std::norm`, for example, if abs(z1) > abs(z2) then norm(z1) > norm(z2).

### [edit] See also

abs(std::complex) | returns the magnitude of a complex number (function template) [edit]
conj | returns the complex conjugate (function template) [edit]
polar | constructs a complex number from magnitude and phase angle (function template) [edit]

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