SDL  2.0
s_tan.c File Reference
#include "math_libm.h"
#include "math_private.h"
+ Include dependency graph for s_tan.c:

Go to the source code of this file.

Functions

double tan (double x)
 

Function Documentation

◆ tan()

double tan ( double  x)

Definition at line 45 of file s_tan.c.

References __ieee754_rem_pio2(), __kernel_tan(), GET_HIGH_WORD, and libm_hidden_def().

Referenced by SDL_tan().

46 {
47  double y[2],z=0.0;
48  int32_t n, ix;
49 
50  /* High word of x. */
51  GET_HIGH_WORD(ix,x);
52 
53  /* |x| ~< pi/4 */
54  ix &= 0x7fffffff;
55  if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1);
56 
57  /* tan(Inf or NaN) is NaN */
58  else if (ix>=0x7ff00000) return x-x; /* NaN */
59 
60  /* argument reduction needed */
61  else {
62  n = __ieee754_rem_pio2(x,y);
63  return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even
64  -1 -- n odd */
65  }
66 }
#define GET_HIGH_WORD(i, d)
Definition: math_private.h:108
GLdouble GLdouble z
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
signed int int32_t
int32_t attribute_hidden __ieee754_rem_pio2(double x, double *y)
Definition: e_rem_pio2.c:69
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
double attribute_hidden __kernel_tan(double x, double y, int iy)
Definition: k_tan.c:69
GLdouble n