Cpp-standard-library-cpp-complex-arg

提供:Dev Guides
移動先:案内検索

C ++複合ライブラリ-Arg

説明

これは複素数の位相角であり、ラジアンで表される複素数xの位相角(または角度成分)を返します。

宣言

以下は、std
argの宣言です。
template<class T> T arg (const complex<T>& x);

C 11

template<class T> T arg (const complex<T>& x);

パラメーター

*x* これは複雑な値です。

戻り値

ラジアンで表された複素数xの位相角(または角度成分)を返します。

例外

none

以下のstd
argの例。
#include <iostream>
#include <complex>

int main () {
   std::complex<double> mycomplex (1.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;
}

サンプル出力は次のようになります-

The polar form of (1,4) is 4.12311*e^i*1.32582rad