Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      imaginary

      From cppreference.com
      <c‎ |numeric‎ |complex
       
       
       
      Complex number arithmetic
      Types and the imaginary constant
      (C99)
      (C99)    
      (C11)
      imaginary
      (C99)
      (C99)
      Manipulation
      (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>
      #define imaginary _Imaginary
      (since C99)

      This macro expands to the keyword_Imaginary.

      This is a convenience macro that makes it possible to usefloat imaginary,double imaginary, andlongdouble imaginary as an alternative way to write the three pure imaginary C typesfloat _Imaginary,double _Imaginary, andlongdouble _Imaginary

      As with any pure imaginary number support in C, this macro is only defined if the imaginary numbers are supported.

      A compiler that defines__STDC_IEC_559_COMPLEX__ is not required to support imaginary numbers. POSIX recommends checking if the macro_Imaginary_I is defined to identify imaginary number support.

      (since C99)
      (until C11)

      Imaginary numbers are supported if__STDC_IEC_559_COMPLEX__ is defined.

      (since C11)

      Contents

      [edit]Notes

      Programs are allowed to undefine and perhaps redefine theimaginary macro.

      To date, only Oracle C compiler is known to have implemented imaginary types.

      [edit]Example

      Run this code
      #include <stdio.h>#include <complex.h> int main(void){double imaginary i=-2.0*I;// pure imaginarydouble f=1.0;// pure realdoublecomplex z= f+ i;// complex numberprintf("z = %.1f%+.1fi\n",creal(z),cimag(z));}

      Output:

      z = 1.0-2.0i

      [edit]References

      • C17 standard (ISO/IEC 9899:2018):
      • 7.3.1/5 imaginary (p: 136)
      • G.6/1 imaginary (p: 391-392)
      • C11 standard (ISO/IEC 9899:2011):
      • 7.3.1/5 imaginary (p: 188)
      • G.6/1 imaginary (p: 537)
      • C99 standard (ISO/IEC 9899:1999):
      • 7.3.1/3 imaginary (p: 170)
      • G.6/1 imaginary (p: 472)

      [edit]See also

      (C99)
      complex type macro
      (keyword macro)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/numeric/complex/imaginary&oldid=168850"

      [8]ページ先頭

      ©2009-2026 Movatter.jp