Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::imag(std::complex)

      From cppreference.com
      <cpp‎ |numeric‎ |complex
       
       
       
       
      Defined in header<complex>
      (1)
      template<class T>
      T imag(conststd::complex<T>& z);
      (until C++14)
      template<class T>
      constexpr T imag(conststd::complex<T>& z);
      (since C++14)
      Defined in header<complex>
      (A)
      float       imag(float f);

      double      imag(double f);

      longdouble imag(longdouble f);
      (until C++14)
      constexprfloat       imag(float f);

      constexprdouble      imag(double f);

      constexprlongdouble imag(longdouble f);
      (since C++14)
      (until C++23)
      template<class FloatingPoint>
      FloatingPoint imag( FloatingPoint f);
      (since C++23)
      (B)
      template<class Integer>
      double imag( Integer i);
      (until C++14)
      template<class Integer>
      constexprdouble imag( Integer i);
      (since C++14)
      1) Returns the imaginary part of the complex numberz, i.e.z.imag().
      A,B) Additional overloads are provided for all integer and floating-point types, which are treated as complex numbers with zero imaginary part.
      (since C++11)

      Contents

      [edit]Parameters

      z - complex value
      f - floating-point value
      i - integer value

      [edit]Return value

      1) The imaginary part ofz.
      A)decltype(f){} (zero).
      B)0.0.

      [edit]Notes

      The additional overloads are not required to be provided exactly as(A,B). They only need to be sufficient to ensure that for their argumentnum:

      • Ifnum has astandard(until C++23) floating-point typeT, thenstd::imag(num) has the same effect asstd::imag(std::complex<T>(num)).
      • Otherwise, ifnum has an integer type, thenstd::imag(num) has the same effect asstd::imag(std::complex<double>(num)).

      [edit]See also

      accesses the imaginary part of the complex number
      (public member function)[edit]
      returns the real part
      (function template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/complex/imag2&oldid=149034"

      [8]ページ先頭

      ©2009-2025 Movatter.jp