Back to index

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

Go to the source code of this file.

Functions

void __sincosf (float x, float *sinx, float *cosx)

Function Documentation

void __sincosf ( float  x,
float *  sinx,
float *  cosx 
)

Definition at line 27 of file s_sincosf.c.

{
  int32_t ix;

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

  /* |x| ~< pi/4 */
  ix &= 0x7fffffff;
  if (ix <= 0x3f490fd8)
    {
      *sinx = __kernel_sinf (x, 0.0, 0);
      *cosx = __kernel_cosf (x, 0.0);
    }
  else if (ix>=0x7f800000)
    {
      /* sin(Inf or NaN) is NaN */
      *sinx = *cosx = x - x;
    }
  else
    {
      /* Argument reduction needed.  */
      float y[2];
      int n;

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

Here is the call graph for this function:

Here is the caller graph for this function: