Back to index

glibc  2.9
Functions
s_cosl.c File Reference
#include "math.h"
#include "math_private.h"
#include <math_ldbl_opt.h>

Go to the source code of this file.

Functions

long double __cosl (long double x)
 long_double_symbol (libm, __cosl, cosl)

Function Documentation

long double __cosl ( long double  x)

Definition at line 54 of file s_cosl.c.

{
       long double y[2],z=0.0L;
       int64_t n, ix;

    /* High word of x. */
       GET_LDOUBLE_MSW64(ix,x);

    /* |x| ~< pi/4 */
       ix &= 0x7fffffffffffffffLL;
       if(ix <= 0x3fe921fb54442d18LL)
         return __kernel_cosl(x,z);

    /* cos(Inf or NaN) is NaN */
       else if (ix>=0x7ff0000000000000LL)
           return x-x;

    /* argument reduction needed */
       else {
           n = __ieee754_rem_pio2l(x,y);
           switch(n&3) {
              case 0:
                  return  __kernel_cosl(y[0],y[1]);
              case 1:
                  return -__kernel_sinl(y[0],y[1],1);
              case 2:
                  return -__kernel_cosl(y[0],y[1]);
              default:
                  return  __kernel_sinl(y[0],y[1],1);
           }
       }
}

Here is the call graph for this function:

long_double_symbol ( libm  ,
__cosl  ,
cosl   
)