Print this page




 104 
 105 
 106 #define one q[0]
 107 #define pp1 q[1]
 108 #define pp2 q[2]
 109 #define pp3 q[3]
 110 #define qq1 q[4]
 111 #define qq2 q[5]
 112 #define t1  q[6]
 113 #define t2  q[7]
 114 #define t3  q[8]
 115 #define t4  q[9]
 116 #define t5  q[10]
 117 #define t6  q[11]
 118 
 119 /* INDENT ON */
 120 
 121 
 122 double
 123 __k_tan(double x, double y, int k) {
 124         double a, t, z, w, s, c, r, rh, xh, xl;
 125         int i, j, hx, ix;
 126 
 127         t = one;
 128         hx = ((int *) &x)[HIWORD];
 129         ix = hx & 0x7fffffff;
 130         if (ix < 0x3fc40000) {
 131                 if (ix < 0x3e400000) {
 132                         if ((i = (int) x) == 0)         /* generate inexact */
 133                                 w = x;
 134                         t = y;
 135                 } else {
 136                         z = x * x;
 137                         t = y + (((t1 * x) * z) * (t2 + z * (t3 + z))) *
 138                                 ((t4 + z) * (t5 + z * (t6 + z)));
 139                         w = x + t;
 140                 }
 141                 if (k == 0)
 142                         return (w);
 143                 /*
 144                 * Compute -1/(x+T) with great care
 145                 * Let r = -1/(x+T), rh = r chopped to 20 bits.
 146                 * Also let xh   = x+T chopped to 20 bits, xl = (x-xh)+T. Then
 147                 *   -1/(x+T)    = rh + (-1/(x+T)-rh) = rh + r*(1+rh*(x+T))
 148                 *               = rh + r*((1+rh*xh)+rh*xl).
 149                 */
 150                 rh = r = -one / w;
 151                 ((int *) &rh)[LOWORD] = 0;




 104 
 105 
 106 #define one q[0]
 107 #define pp1 q[1]
 108 #define pp2 q[2]
 109 #define pp3 q[3]
 110 #define qq1 q[4]
 111 #define qq2 q[5]
 112 #define t1  q[6]
 113 #define t2  q[7]
 114 #define t3  q[8]
 115 #define t4  q[9]
 116 #define t5  q[10]
 117 #define t6  q[11]
 118 
 119 /* INDENT ON */
 120 
 121 
 122 double
 123 __k_tan(double x, double y, int k) {
 124         double a, t, z, w = 0.0L, s, c, r, rh, xh, xl;
 125         int i, j, hx, ix;
 126 
 127         t = one;
 128         hx = ((int *) &x)[HIWORD];
 129         ix = hx & 0x7fffffff;
 130         if (ix < 0x3fc40000) {               /* 0.15625 */
 131                 if (ix < 0x3e400000) {       /* 2^-27 */
 132                         if ((i = (int) x) == 0)         /* generate inexact */
 133                                 w = x;
 134                         t = y;
 135                 } else {
 136                         z = x * x;
 137                         t = y + (((t1 * x) * z) * (t2 + z * (t3 + z))) *
 138                                 ((t4 + z) * (t5 + z * (t6 + z)));
 139                         w = x + t;
 140                 }
 141                 if (k == 0)
 142                         return (w);
 143                 /*
 144                 * Compute -1/(x+T) with great care
 145                 * Let r = -1/(x+T), rh = r chopped to 20 bits.
 146                 * Also let xh   = x+T chopped to 20 bits, xl = (x-xh)+T. Then
 147                 *   -1/(x+T)    = rh + (-1/(x+T)-rh) = rh + r*(1+rh*(x+T))
 148                 *               = rh + r*((1+rh*xh)+rh*xl).
 149                 */
 150                 rh = r = -one / w;
 151                 ((int *) &rh)[LOWORD] = 0;