Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      cexpf, cexp, cexpl

      From cppreference.com
      <c‎ |numeric‎ |complex
       
       
       
      Complex number arithmetic
      Types and the imaginary constant
      (C99)
      (C99)    
      (C11)
      (C99)
      Manipulation
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
      Power and exponential functions
      cexp
      (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       cexpf(floatcomplex z);
      (1)(since C99)
      doublecomplex      cexp(doublecomplex z);
      (2)(since C99)
      longdoublecomplex cexpl(longdoublecomplex z);
      (3)(since C99)
      Defined in header<tgmath.h>
      #define exp( z )
      (4)(since C99)
      1-3) Computes the complex base-e exponential ofz.
      4) Type-generic macro: Ifz has typelongdoublecomplex,cexpl is called. ifz has typedoublecomplex,cexp is called, ifz has typefloatcomplex,cexpf is called. Ifz is real or integer, then the macro invokes the corresponding real function (expf,exp,expl). Ifz is imaginary, the corresponding complex argument version is called.

      Contents

      [edit]Parameters

      z - complex argument

      [edit]Return value

      If no errors occur,e raised to the power ofz,\(\small e^z\)ez
      is returned.

      [edit]Error handling and special values

      Errors are reported consistent withmath_errhandling.

      If the implementation supports IEEE floating-point arithmetic,

      • cexp(conj(z))==conj(cexp(z))
      • Ifz is±0+0i, the result is1+0i
      • Ifz isx+∞i (for any finite x), the result isNaN+NaNi andFE_INVALID is raised.
      • Ifz isx+NaNi (for any finite x), the result isNaN+NaNi andFE_INVALID may be raised.
      • Ifz is+∞+0i, the result is+∞+0i
      • Ifz is-∞+yi (for any finite y), the result is+0cis(y)
      • Ifz is+∞+yi (for any finite nonzero y), the result is+∞cis(y)
      • Ifz is-∞+∞i, the result is±0±0i (signs are unspecified)
      • Ifz is+∞+∞i, the result is±∞+NaNi andFE_INVALID is raised (the sign of the real part is unspecified)
      • Ifz is-∞+NaNi, the result is±0±0i (signs are unspecified)
      • Ifz is+∞+NaNi, the result is±∞+NaNi (the sign of the real part is unspecified)
      • Ifz isNaN+0i, the result isNaN+0i
      • Ifz isNaN+yi (for any nonzero y), the result isNaN+NaNi andFE_INVALID may be raised
      • Ifz isNaN+NaNi, the result isNaN+NaNi

      where\(\small{\rm cis}(y)\)cis(y) is\(\small \cos(y)+{\rm i}\sin(y)\)cos(y) + i sin(y)

      [edit]Notes

      The complex exponential function\(\small e^z\)ez
      for\(\small z = x + {\rm i}y\)z = x+iy equals\(\small e^x {\rm cis}(y)\)ex
      cis(y)
      , or,\(\small e^x (\cos(y)+{\rm i}\sin(y))\)ex
      (cos(y) + i sin(y))

      The exponential function is anentire function in the complex plane and has no branch cuts.

      [edit]Example

      Run this code
      #include <stdio.h>#include <math.h>#include <complex.h> int main(void){double PI=acos(-1);doublecomplex z= cexp(I* PI);// Euler's formulaprintf("exp(i*pi) = %.1f%+.1fi\n",creal(z),cimag(z)); }

      Output:

      exp(i*pi) = -1.0+0.0i

      [edit]References

      • C11 standard (ISO/IEC 9899:2011):
      • 7.3.7.1 The cexp functions (p: 194)
      • 7.25 Type-generic math <tgmath.h> (p: 373-375)
      • G.6.3.1 The cexp functions (p: 543)
      • G.7 Type-generic math <tgmath.h> (p: 545)
      • C99 standard (ISO/IEC 9899:1999):
      • 7.3.7.1 The cexp functions (p: 176)
      • 7.22 Type-generic math <tgmath.h> (p: 335-337)
      • G.6.3.1 The cexp functions (p: 478)
      • G.7 Type-generic math <tgmath.h> (p: 480)

      [edit]See also

      (C99)(C99)(C99)
      computes the complex natural logarithm
      (function)[edit]
      (C99)(C99)
      computese raised to the given power (\({\small e^x}\)ex)
      (function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/numeric/complex/cexp&oldid=147325"

      [8]ページ先頭

      ©2009-2025 Movatter.jp