Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      cimagf, cimag, cimagl

      From cppreference.com
      <c‎ |numeric‎ |complex
       
       
       
      Complex number arithmetic
      Types and the imaginary constant
      (C99)
      (C99)    
      (C11)
      (C99)
      Manipulation
      cimag
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
      Power and exponential functions
      (C99)
      (C99)
      (C99)
      (C99)
      Trigonometric functions
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
      Hyperbolic functions
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
       
      Defined in header<complex.h>
      float       cimagf(floatcomplex z);
      (1)(since C99)
      double      cimag(doublecomplex z);
      (2)(since C99)
      longdouble cimagl(longdoublecomplex z);
      (3)(since C99)
      Defined in header<tgmath.h>
      #define cimag( z )
      (4)(since C99)
      1-3) Returns the imaginary part ofz.
      4) Type-generic macro: ifz has typelongdoublecomplex,longdoubleimaginary, orlongdouble,cimagl is called. Ifz has typefloatcomplex,floatimaginary, orfloat,cimagf is called. Ifz has typedoublecomplex,doubleimaginary,double, or any integer type,cimag is called.

      Contents

      [edit]Parameters

      z - complex argument

      [edit]Return value

      The imaginary part ofz.

      This function is fully specified for all possible inputs and is not subject to any errors described inmath_errhandling

      [edit]Notes

      For any complex variablez,z==creal(z)+ I*cimag(z).

      [edit]Example

      Run this code
      #include <stdio.h>#include <complex.h> int main(void){doublecomplex z=1.0+2.0*I;printf("%f%+fi\n",creal(z), cimag(z));}

      Output:

      1.000000+2.000000i

      [edit]References

      • C11 standard (ISO/IEC 9899:2011):
      • 7.3.9.2 The cimag functions (p: 197)
      • 7.25 Type-generic math <tgmath.h> (p: 373-375)
      • G.7 Type-generic math <tgmath.h> (p: 545)
      • C99 standard (ISO/IEC 9899:1999):
      • 7.3.9.2 The cimag functions (p: 178-179)
      • 7.22 Type-generic math <tgmath.h> (p: 335-337)
      • G.7 Type-generic math <tgmath.h> (p: 480)

      [edit]See also

      (C99)(C99)(C99)
      computes the real part of a complex number
      (function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/numeric/complex/cimag&oldid=77458"

      [8]ページ先頭

      ©2009-2025 Movatter.jp