C examples for complex.h:arg
function template
<complex> <complex.h>
Phase angle of complex
template<class T> T arg (const complex<T>& x); double arg (ArithmeticType x); // additional overloads
atan2(x.imag(),x.real());
Parameter | Description |
---|---|
x | Complex value. |
Phase angle of x.
#include <iostream> #include <complex> int main ()/*from w ww.j a va 2s . c o m*/ { std::complex<double> mycomplex (3.0,4.0); std::cout << "The polar form of " << mycomplex; std::cout << " is " << std::abs(mycomplex) << "*e^i*" << std::arg(mycomplex) << "rad\n"; return 0; }