Back to index

glibc  2.9
Functions
s_sincosl.c File Reference
#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

void __sincosl (long double x, long double *sinx, long double *cosx)

Function Documentation

void __sincosl ( long double  x,
long double *  sinx,
long double *  cosx 
)

Definition at line 27 of file s_sincosl.c.

{
  int64_t ix;

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

  /* |x| ~< pi/4 */
  ix &= 0x7fffffffffffffffLL;
  if (ix <= 0x3ffe921fb54442d1LL)
    __kernel_sincosl (x, 0.0L, sinx, cosx, 0);
  else if (ix >= 0x7fff000000000000LL)
    {
      /* sin(Inf or NaN) is NaN */
      *sinx = *cosx = x - x;
    }
  else
    {
      /* Argument reduction needed.  */
      long double y[2];
      int n;

      n = __ieee754_rem_pio2l (x, y);
      switch (n & 3)
       {
       case 0:
         __kernel_sincosl (y[0], y[1], sinx, cosx, 1);
         break;
       case 1:
         __kernel_sincosl (y[0], y[1], cosx, sinx, 1);
         *cosx = -*cosx;
         break;
       case 2:
         __kernel_sincosl (y[0], y[1], sinx, cosx, 1);
         *sinx = -*sinx;
         *cosx = -*cosx;
         break;
       default:
         __kernel_sincosl (y[0], y[1], cosx, sinx, 1);
         *sinx = -*sinx;
         break;
       }
    }
}

Here is the call graph for this function: