Back to index

glibc  2.9
Functions
s_cprojl.c File Reference
#include <complex.h>
#include <math.h>
#include <math_ldbl_opt.h>

Go to the source code of this file.

Functions

__complex__ long double __cprojl (__complex__ long double x)
 long_double_symbol (libm, __cprojl, cprojl)

Function Documentation

__complex__ long double __cprojl ( __complex__ long double  x)

Definition at line 26 of file s_cprojl.c.

{
  __complex__ long double res;

  if (isnan (__real__ x) && isnan (__imag__ x))
    return x;
  else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
    {
      __real__ res = INFINITY;
      __imag__ res = __copysignl (0.0, __imag__ x);
    }
  else
    {
      long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x
                      + 1.0);

      __real__ res = (2.0 * __real__ x) / den;
      __imag__ res = (2.0 * __imag__ x) / den;
      /* __gcc_qmul does not respect -0.0 so we need the following fixup.  */
       if (__real__ x == 0.0)
         __real__ res = __real__ x;

       if (__imag__ x == 0.0)
         __imag__ res = __imag__ x;
    }

  return res;
}

Here is the call graph for this function:

long_double_symbol ( libm  ,
__cprojl  ,
cprojl   
)