Print this page




  59 #define P1      C[2]
  60 #define P2      C[3]
  61 #define P3      C[4]
  62 #define P4      C[5]
  63 #define P5      C[6]
  64 #define P6      C[7]
  65 #define P7      C[8]
  66 #define T0      C[9]
  67 #define T1      C[10]
  68 #define invpio2 C[11]
  69 #define half    C[12]
  70 #define pio2_1  C[13]
  71 #define pio2_t  C[14]
  72 
  73 float
  74 tanf(float x)
  75 {
  76         double  y, z, w;
  77         float   f;
  78         int     n, ix, hx, hy;

  79 
  80         hx = *((int *)&x);
  81         ix = hx & 0x7fffffff;
  82 
  83         y = (double)x;
  84 
  85         if (ix <= 0x4016cbe4) {              /* |x| < 3*pi/4 */
  86                 if (ix <= 0x3f490fdb) {              /* |x| < pi/4 */
  87                         if (ix < 0x3c000000) {               /* |x| < 2**-7 */
  88                                 if (ix <= 0x39800000) {      /* |x| < 2**-12 */
  89                                         volatile int    i = (int)y;
  90 #ifdef lint
  91                                         i = i;
  92 #endif
  93                                         return (x);
  94                                 }
  95                                 return ((float)((y * T0) * (T1 + y * y)));
  96                         }
  97                         z = y * y;
  98                         return ((float)(((P0 * y) * (P1 + z * (P2 + z)) *
  99                             (P3 + z * (P4 + z))) *
 100                             (P5 + z * (P6 + z * (P7 + z)))));
 101                 }
 102                 if (hx > 0)
 103                         y = (y - pio2_1) - pio2_t;
 104                 else
 105                         y = (y + pio2_1) + pio2_t;
 106                 hy = ((int *)&y)[HIWORD] & ~0x80000000;
 107                 if (hy < 0x3f800000) {               /* |y| < 2**-7 */
 108                         z = (y * T0) * (T1 + y * y);
 109                         return ((float)(-one / z));




  59 #define P1      C[2]
  60 #define P2      C[3]
  61 #define P3      C[4]
  62 #define P4      C[5]
  63 #define P5      C[6]
  64 #define P6      C[7]
  65 #define P7      C[8]
  66 #define T0      C[9]
  67 #define T1      C[10]
  68 #define invpio2 C[11]
  69 #define half    C[12]
  70 #define pio2_1  C[13]
  71 #define pio2_t  C[14]
  72 
  73 float
  74 tanf(float x)
  75 {
  76         double  y, z, w;
  77         float   f;
  78         int     n, ix, hx, hy;
  79         volatile int i;
  80 
  81         hx = *((int *)&x);
  82         ix = hx & 0x7fffffff;
  83 
  84         y = (double)x;
  85 
  86         if (ix <= 0x4016cbe4) {              /* |x| < 3*pi/4 */
  87                 if (ix <= 0x3f490fdb) {              /* |x| < pi/4 */
  88                         if (ix < 0x3c000000) {               /* |x| < 2**-7 */
  89                                 if (ix <= 0x39800000) {      /* |x| < 2**-12 */
  90                                         i = (int)y;
  91 #ifdef lint
  92                                         i = i;
  93 #endif
  94                                         return (x);
  95                                 }
  96                                 return ((float)((y * T0) * (T1 + y * y)));
  97                         }
  98                         z = y * y;
  99                         return ((float)(((P0 * y) * (P1 + z * (P2 + z)) *
 100                             (P3 + z * (P4 + z))) *
 101                             (P5 + z * (P6 + z * (P7 + z)))));
 102                 }
 103                 if (hx > 0)
 104                         y = (y - pio2_1) - pio2_t;
 105                 else
 106                         y = (y + pio2_1) + pio2_t;
 107                 hy = ((int *)&y)[HIWORD] & ~0x80000000;
 108                 if (hy < 0x3f800000) {               /* |y| < 2**-7 */
 109                         z = (y * T0) * (T1 + y * y);
 110                         return ((float)(-one / z));