Back to index

glibc  2.9
Functions
s_ctanl.c File Reference
#include <complex.h>
#include <fenv.h>
#include <math.h>
#include "math_private.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

__complex__ long double __ctanl (__complex__ long double x)

Function Documentation

__complex__ long double __ctanl ( __complex__ long double  x)

Definition at line 29 of file s_ctanl.c.

{
  __complex__ long double res;

  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
    {
      if (__isinfl (__imag__ x))
       {
         __real__ res = __copysignl (0.0, __real__ x);
         __imag__ res = __copysignl (1.0, __imag__ x);
       }
      else if (__real__ x == 0.0)
       {
         res = x;
       }
      else
       {
         __real__ res = __nanl ("");
         __imag__ res = __nanl ("");

#ifdef FE_INVALID
         if (__isinfl (__real__ x))
           feraiseexcept (FE_INVALID);
#endif
       }
    }
  else
    {
      long double sin2rx, cos2rx;
      long double den;

      __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx);

      den = cos2rx + __ieee754_coshl (2.0 * __imag__ x);


      if (den == 0.0)
       {
         __complex__ long double ez = __cexpl (1.0i * x);
         __complex__ long double emz = __cexpl (-1.0i * x);

         res = (ez - emz) / (ez + emz) * -1.0i;
       }
      else
       {
         __real__ res = sin2rx / den;
         __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den;
       }
    }

  return res;
}

Here is the call graph for this function: