Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      cacosf, cacos, cacosl

      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
      (C99)
      (C99)
      (C99)
      (C99)
      Trigonometric functions
      (C99)
      (C99)
      (C99)
      cacos
      (C99)
      (C99)
      (C99)
      Hyperbolic functions
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
      (C99)
       
      Defined in header<complex.h>
      floatcomplex       cacosf(floatcomplex z);
      (1)(since C99)
      doublecomplex      cacos(doublecomplex z);
      (2)(since C99)
      longdoublecomplex cacosl(longdoublecomplex z);
      (3)(since C99)
      Defined in header<tgmath.h>
      #define acos( z )
      (4)(since C99)
      1-3) Computes the complex arc cosine ofz with branch cuts outside the interval[−1,+1] along the real axis.
      4) Type-generic macro: Ifz has typelongdoublecomplex,cacosl is called. ifz has typedoublecomplex,cacos is called, ifz has typefloatcomplex,cacosf is called. Ifz is real or integer, then the macro invokes the corresponding real function (acosf,acos,acosl). Ifz is imaginary, then the macro invokes the corresponding complex number version.

      Contents

      [edit]Parameters

      z - complex argument

      [edit]Return value

      If no errors occur, complex arc cosine ofz is returned, in the range a strip unbounded along the imaginary axis and in the interval [0; π] along the real axis.

      [edit]Error handling and special values

      Errors are reported consistent withmath_errhandling.

      If the implementation supports IEEE floating-point arithmetic,

      • cacos(conj(z))==conj(cacos(z))
      • Ifz is±0+0i, the result isπ/2-0i
      • Ifz is±0+NaNi, the result isπ/2+NaNi
      • Ifz isx+∞i (for any finite x), the result isπ/2-∞i
      • Ifz isx+NaNi (for any nonzero finite x), the result isNaN+NaNi andFE_INVALID may be raised.
      • Ifz is-∞+yi (for any positive finite y), the result isπ-∞i
      • Ifz is+∞+yi (for any positive finite y), the result is+0-∞i
      • Ifz is-∞+∞i, the result is3π/4-∞i
      • Ifz is+∞+∞i, the result isπ/4-∞i
      • Ifz is±∞+NaNi, the result isNaN±∞i (the sign of the imaginary part is unspecified)
      • Ifz isNaN+yi (for any finite y), the result isNaN+NaNi andFE_INVALID may be raised
      • Ifz isNaN+∞i, the result isNaN-∞i
      • Ifz isNaN+NaNi, the result isNaN+NaNi

      [edit]Notes

      Inverse cosine (or arc cosine) is a multivalued function and requires a branch cut on the complex plane. The branch cut is conventially placed at the line segments(-∞,-1) and(1,∞) of the real axis.

      The mathematical definition of the principal value of arc cosine isacos z =
      1
      2
      π +iln(iz +1-z2
      )

      For any z,acos(z) = π - acos(-z)

      [edit]Example

      Run this code
      #include <stdio.h>#include <math.h>#include <complex.h> int main(void){doublecomplex z= cacos(-2);printf("cacos(-2+0i) = %f%+fi\n",creal(z),cimag(z)); doublecomplex z2= cacos(conj(-2));// or CMPLX(-2, -0.0)printf("cacos(-2-0i) (the other side of the cut) = %f%+fi\n",creal(z2),cimag(z2)); // for any z, acos(z) = pi - acos(-z)double pi=acos(-1);doublecomplex z3=ccos(pi-z2);printf("ccos(pi - cacos(-2-0i) = %f%+fi\n",creal(z3),cimag(z3));}

      Output:

      cacos(-2+0i) = 3.141593-1.316958icacos(-2-0i) (the other side of the cut) = 3.141593+1.316958iccos(pi - cacos(-2-0i) = 2.000000+0.000000i

      [edit]References

      • C11 standard (ISO/IEC 9899:2011):
      • 7.3.5.1 The cacos functions (p: 190)
      • 7.25 Type-generic math <tgmath.h> (p: 373-375)
      • G.6.1.1 The cacos functions (p: 539)
      • G.7 Type-generic math <tgmath.h> (p: 545)
      • C99 standard (ISO/IEC 9899:1999):
      • 7.3.5.1 The cacos functions (p: 172)
      • 7.22 Type-generic math <tgmath.h> (p: 335-337)
      • G.6.1.1 The cacos functions (p: 474)
      • G.7 Type-generic math <tgmath.h> (p: 480)

      [edit]See also

      (C99)(C99)(C99)
      computes the complex arc sine
      (function)[edit]
      (C99)(C99)(C99)
      computes the complex arc tangent
      (function)[edit]
      (C99)(C99)(C99)
      computes the complex cosine
      (function)[edit]
      (C99)(C99)
      computes arc cosine (\({\small\arccos{x} }\)arccos(x))
      (function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/numeric/complex/cacos&oldid=136775"

      [8]ページ先頭

      ©2009-2025 Movatter.jp