Cpp-standard-library-cpp-complex-abs

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

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

説明

これは、複素数の絶対値であり、複素数xの絶対値を返します。

宣言

以下は、std
absの宣言です。

パラメーター

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

戻り値

複素数xの絶対値を返します。

例外

none

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

int main () {
   std::complex<double> mycomplex (1.0,4.0);

   std::cout << "The absolute value of " << mycomplex << " is " << std::abs(mycomplex)
      << '\n';
   return 0;
}

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

The absolute value of (1,4) is 4.12311