Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      conjf, conj, conjl

      From cppreference.com
      <c‎ |numeric‎ |complex
       
       
       
      Complex number arithmetic
      Types and the imaginary constant
      (C99)
      (C99)    
      (C11)
      (C99)
      Manipulation
      (C99)
      (C99)
      (C99)
      (C99)
      conj
      (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>
      floatcomplex       conjf(floatcomplex z);
      (1)(since C99)
      doublecomplex      conj(doublecomplex z);
      (2)(since C99)
      longdoublecomplex conjl(longdoublecomplex z);
      (3)(since C99)
      Defined in header<tgmath.h>
      #define conj( z )
      (4)(since C99)
      1-3) Computes thecomplex conjugate ofz by reversing the sign of the imaginary part.
      4) Type-generic macro: ifz has typelongdoublecomplex,longdoubleimaginary, orlongdouble,conjl is called. Ifz has typefloatcomplex,floatimaginary, orfloat,conjf is called. Ifz has typedoublecomplex,doubleimaginary,double, or any integer type,conj is called.

      Contents

      [edit]Parameters

      z - complex argument

      [edit]Return value

      The complex conjugate ofz.

      [edit]Notes

      On C99 implementations that do not implementI as_Imaginary_I,conj may be used to obtain complex numbers with negative zero imaginary part. In C11, the macroCMPLX is used for that purpose.

      [edit]Example

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

      Output:

      The conjugate of 1.0+2.0i is 1.0-2.0iTheir product is 5.0+0.0i

      [edit]References

      • C11 standard (ISO/IEC 9899:2011):
      • 7.3.9.4 The conj functions (p: 198)
      • 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.3 The conj functions (p: 179)
      • 7.22 Type-generic math <tgmath.h> (p: 335-337)
      • G.7 Type-generic math <tgmath.h> (p: 480)

      [edit]See also

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/numeric/complex/conj&oldid=77461"

      [8]ページ先頭

      ©2009-2025 Movatter.jp