Print this page




  54 /* P7 */ -1.81484378878349295050043110677506774663925170898e+0000,
  55 /* T0 */  3.333335997532835641297409611782510896641e-0001,
  56 /* T1 */  2.999997598248363761541668282006867229939e+00,
  57 };
  58 /* INDENT ON */
  59 
  60 #define one q[0]
  61 #define P0 q[1]
  62 #define P1 q[2]
  63 #define P2 q[3]
  64 #define P3 q[4]
  65 #define P4 q[5]
  66 #define P5 q[6]
  67 #define P6 q[7]
  68 #define P7 q[8]
  69 #define T0 q[9]
  70 #define T1 q[10]
  71 
  72 float
  73 __k_tanf(double x, int n) {
  74         float ft;
  75         double z, w;
  76         int ix;
  77 
  78         ix = ((int *) &x)[HIWORD] & ~0x80000000;        /* ix = leading |x| */
  79         /* small argument */
  80         if (ix < 0x3f800000) {               /* if |x| < 0.0078125 = 2**-7 */
  81                 if (ix < 0x3f100000) {       /* if |x| < 2**-14 */
  82                         if ((int) x == 0) {     /* raise inexact if x!=0 */
  83                                 ft = n == 0 ? (float) x : (float) (-one / x);
  84                         }
  85                         return (ft);
  86                 }
  87                 z = (x * T0) * (T1 + x * x);
  88                 ft = n == 0 ? (float) z : (float) (-one / z);
  89                 return (ft);
  90         }
  91         z = x * x;
  92         w = ((P0 * x) * (P1 + z * (P2 + z)) * (P3 + z * (P4 + z)))
  93                 * (P5 + z * (P6 + z * (P7 + z)));
  94         ft = n == 0 ? (float) w : (float) (-one / w);


  54 /* P7 */ -1.81484378878349295050043110677506774663925170898e+0000,
  55 /* T0 */  3.333335997532835641297409611782510896641e-0001,
  56 /* T1 */  2.999997598248363761541668282006867229939e+00,
  57 };
  58 /* INDENT ON */
  59 
  60 #define one q[0]
  61 #define P0 q[1]
  62 #define P1 q[2]
  63 #define P2 q[3]
  64 #define P3 q[4]
  65 #define P4 q[5]
  66 #define P5 q[6]
  67 #define P6 q[7]
  68 #define P7 q[8]
  69 #define T0 q[9]
  70 #define T1 q[10]
  71 
  72 float
  73 __k_tanf(double x, int n) {
  74         float ft = 0.0;
  75         double z, w;
  76         int ix;
  77 
  78         ix = ((int *) &x)[HIWORD] & ~0x80000000;        /* ix = leading |x| */
  79         /* small argument */
  80         if (ix < 0x3f800000) {               /* if |x| < 0.0078125 = 2**-7 */
  81                 if (ix < 0x3f100000) {       /* if |x| < 2**-14 */
  82                         if ((int) x == 0) {     /* raise inexact if x!=0 */
  83                                 ft = n == 0 ? (float) x : (float) (-one / x);
  84                         }
  85                         return (ft);
  86                 }
  87                 z = (x * T0) * (T1 + x * x);
  88                 ft = n == 0 ? (float) z : (float) (-one / z);
  89                 return (ft);
  90         }
  91         z = x * x;
  92         w = ((P0 * x) * (P1 + z * (P2 + z)) * (P3 + z * (P4 + z)))
  93                 * (P5 + z * (P6 + z * (P7 + z)));
  94         ft = n == 0 ? (float) w : (float) (-one / w);