Back to index

lightning-sunbird  0.9+nobinonly
s_cos.c File Reference
#include "fdlibm.h"

Go to the source code of this file.


double fd_cos (double x)

Function Documentation

double fd_cos ( double  x)

Definition at line 88 of file s_cos.c.

        fd_twoints u;
       double y[2],z=0.0;
       int n, ix;

    /* High word of x. */
        u.d = x;
       ix = __HI(u);

    /* |x| ~< pi/4 */
       ix &= 0x7fffffff;
       if(ix <= 0x3fe921fb) return __kernel_cos(x,z);

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

    /* argument reduction needed */
       else {
           n = __ieee754_rem_pio2(x,y);
           switch(n&3) {
              case 0: return  __kernel_cos(y[0],y[1]);
              case 1: return -__kernel_sin(y[0],y[1],1);
              case 2: return -__kernel_cos(y[0],y[1]);
                      return  __kernel_sin(y[0],y[1],1);

Here is the call graph for this function:

Here is the caller graph for this function: