Back to index

glibc  2.9
Functions
s_ctanf.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__ float __ctanf (__complex__ float x)

Function Documentation

__complex__ float __ctanf ( __complex__ float  x)

Definition at line 29 of file s_ctanf.c.

{
  __complex__ float res;

  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
    {
      if (__isinff (__imag__ x))
       {
         __real__ res = __copysignf (0.0, __real__ x);
         __imag__ res = __copysignf (1.0, __imag__ x);
       }
      else if (__real__ x == 0.0)
       {
         res = x;
       }
      else
       {
         __real__ res = __nanf ("");
         __imag__ res = __nanf ("");

#ifdef FE_INVALID
         if (__isinff (__real__ x))
           feraiseexcept (FE_INVALID);
#endif
       }
    }
  else
    {
      float sin2rx, cos2rx;
      float den;

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

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


      if (den == 0.0)
       {
         __complex__ float ez = __cexpf (1.0i * x);
         __complex__ float emz = __cexpf (-1.0i * x);

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

  return res;
}

Here is the call graph for this function: