Back to index

glibc  2.9
Functions
s_catanhf.c File Reference
#include <complex.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 __catanhf (__complex__ float x)

Function Documentation

__complex__ float __catanhf ( __complex__ float  x)

Definition at line 28 of file s_catanhf.c.

{
  __complex__ float res;
  int rcls = fpclassify (__real__ x);
  int icls = fpclassify (__imag__ x);

  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
    {
      if (icls == FP_INFINITE)
       {
         __real__ res = __copysignf (0.0, __real__ x);
         __imag__ res = __copysignf (M_PI_2, __imag__ x);
       }
      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
       {
         __real__ res = __copysignf (0.0, __real__ x);
         if (icls >= FP_ZERO)
           __imag__ res = __copysignf (M_PI_2, __imag__ x);
         else
           __imag__ res = __nanf ("");
       }
      else
       {
         __real__ res = __nanf ("");
         __imag__ res = __nanf ("");
       }
    }
  else if (rcls == FP_ZERO && icls == FP_ZERO)
    {
      res = x;
    }
  else
    {
      float i2, num, den;

      i2 = __imag__ x * __imag__ x;

      num = 1.0 + __real__ x;
      num = i2 + num * num;

      den = 1.0 - __real__ x;
      den = i2 + den * den;

      __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den));

      den = 1 - __real__ x * __real__ x - i2;

      __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den);
    }

  return res;
}

Here is the call graph for this function: