Back to index

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

Go to the source code of this file.

Functions

long double __cosl (long double x)

Function Documentation

long double __cosl ( long double  x)

Definition at line 58 of file s_cosl.c.

{
       long double y[2],z=0.0;
       int32_t n, se, i0, i1;

    /* High word of x. */
       GET_LDOUBLE_WORDS(se,i0,i1,x);

    /* |x| ~< pi/4 */
       se &= 0x7fff;
       if(se < 0x3ffe || (se == 0x3ffe && i0 <= 0xc90fdaa2))
         return __kernel_cosl(x,z);

    /* cos(Inf or NaN) is NaN */
       else if (se==0x7fff) 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: