arg - C complex.h

C examples for complex.h:arg

Type

function template

From


<complex>
<complex.h>

Description

Phase angle of complex

Prototype

     template<class T> 
     T arg (const complex<T>& x);
double arg (ArithmeticType x);  // additional overloads
atan2(x.imag(),x.real());

Parameters

Parameter Description
x Complex value.

Return value

Phase angle of x.

Demo Code

#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;
}

Related Tutorials