C examples for complex.h:norm
function template
<complex> <complex.h>
template<class T> T norm (const complex<T>& x); double norm (ArithmeticType x); // additional overloads
Returns the norm value of the complex number x.
The norm value of a complex number is its squared magnitude, defined as the addition of the square of both its real and its imaginary part without the imaginary unit.
Parameter | Description |
---|---|
x | Complex value. |
Norm value of x.
#include <iostream> #include <complex> int main ()/*from w w w .j av a 2 s. com*/ { std::complex<double> mycomplex (3.0,4.0); std::cout << "The norm of " << mycomplex << " is " << std::norm(mycomplex) << '\n'; return 0; }