complex<long double>

オブジェクト型 long double ことを示し1 番複素数の実数部と 2 番目のオブジェクトのペアが格納された順序として表す部分を表します。

template<>
   class complex<long double> {
public:
   complex(
      long double _RealVal = 0, 
      long double _ImagVal = 0
   );
complex(
      const complex<long double>& _ComplexNum
   );
   // rest same as template class complex
};

パラメーター

  • _RealVal
    構築される複素数の実数部の型 long double の値。

  • _ImagVal
    構築と複素数のパートの型 long double の値。

  • _ComplexNum
    倍精度浮動小数点型 構築された型 long double の複合型を初期化するために実際つまり部分に使用される複合型または型の フローティング

戻り値

型 long double の複合型。

解説

型 long double の複雑なクラスへのテンプレート クラスの複合の明示的な特殊化にはコンストラクター内でしか定義するテンプレート クラスとは異なります。long double から フローティング への変換が暗黙的な long double が 倍精度浮動小数点型 からへの変換は 明示 である必要があります。 明示 の使用はの構文を使用して型変換で開始を除外します。

テンプレート クラス complex の詳細についてはcomplex Class を参照してください。テンプレート クラス complex のメンバー一覧については複雑なメンバー を参照してください。

使用例

// complex_comp_ld.cpp
// compile with: /EHsc
#include <complex>
#include <iostream>

int main( )
{
   using namespace std;
   double pi = 3.14159265359;

   // The first constructor specifies real & imaginary parts
   complex <long double> c1 ( 4.0 , 5.0 );
   cout << "Specifying initial real & imaginary parts,\n"
        << " as type float gives c1 = " << c1 << endl;

   // The second constructor initializes values of the real &
   // imaginary parts using those of complex number of type float
   complex <float> c2float ( 1.0 , 3.0 );
   complex <long double> c2longdouble ( c2float );
   cout << "Implicit conversion from type float to type long double,"
        << "\n gives c2longdouble = " << c2longdouble << endl;

   // The third constructor initializes values of the real &
   // imaginary parts using those of a complex number
   // of type double
   complex <double> c3double ( 3.0 , 4.0 );
   complex <long double> c3longdouble ( c3double );
   cout << "Implicit conversion from type long double to type float,"
        << "\n gives c3longdouble = " << c3longdouble << endl;

   // The modulus and argument of a complex number can be recovered
   double absc3 = abs ( c3longdouble );
   double argc3 = arg ( c3longdouble );
   cout << "The modulus of c3 is recovered from c3 using: abs ( c3 ) = "
        << absc3 << endl;
   cout << "Argument of c3 is recovered from c3 using:\n arg ( c3 ) = "
        << argc3 << " radians, which is " << argc3 * 180 / pi
        << " degrees." << endl;
}
  

必要条件

ヘッダー : <complex>

名前空間: std

参照

関連項目

complex Class

C++ の標準ライブラリのスレッド セーフ

その他の技術情報

<complex> メンバー

複雑なメンバー