pow - C complex.h

C examples for complex.h:pow

type

function template

From


<complex>
<complex.h>

Prototype

template<class T> complex<T> pow (const complex<T>& x, int y);
template<class T> complex<T> pow (const complex<T>& x, const complex<T>& y);
template<class T> complex<T> pow (const complex<T>& x, const T& y);
template<class T> complex<T> pow (const T& x, const complex<T>& y);

Description

Power of complex

exp(y*log(x))

Parameters

Parameter Description
x Base value.
yExponent value.

Demo Code

#include <iostream> // std::cout
#include <complex> // std::complex, std::polar

int main ()//from w ww  .  j av  a2 s.c o m
{
  std::complex<double> mycomplex (3.0,4.0);
  std::cout << " is " << std::pow (mycomplex, 0.5) << '\n';

  return 0;
}

Related Tutorials