80 /* 81 * 82 * |cos(x) - (1+q1*x^2+...+ q8*x^16)| <= 2^-117.11 for |x|<= 0.15625 83 */ 84 q1 = -4.999999999999999999999999999999756416975e-0001L, 85 q2 = 4.166666666666666666666666664006066577258e-0002L, 86 q3 = -1.388888888888888888888877700363937169637e-0003L, 87 q4 = 2.480158730158730158494468463031814083559e-0005L, 88 q5 = -2.755731922398586276322819250356005542871e-0007L, 89 q6 = 2.087675698767424261441959760729854017855e-0009L, 90 q7 = -1.147074481239662089072452129010790774761e-0011L, 91 q8 = 4.777761647399651599730663422263531034782e-0014L; 92 /* INDENT ON */ 93 long double 94 __k_sincosl(long double x, long double y, long double *c) { 95 long double a1, a2, t, t1, t2, z, w; 96 int *pt = (int *) &t, *px = (int *) &x; 97 int i, j, hx, ix; 98 99 t = 1.0; 100 #if defined(_BIG_ENDIAN) 101 hx = px[0]; 102 #else 103 XTOI(px, hx); 104 #endif 105 ix = hx & 0x7fffffff; 106 if (ix < 0x3ffc4000) { 107 if (ix < 0x3fc60000) 108 if (((int) x) == 0) { 109 *c = one; 110 return (x); 111 } /* generate inexact */ 112 z = x * x; 113 114 if (ix < 0x3ff80000) { 115 *c = one + z * (qq1 + z * (qq2 + z * (qq3 + z * (qq4 + 116 z * qq5)))); 117 t = z * (p1 + z * (p2 + z * (p3 + z * (p4 + z * (p5 + 118 z * p6))))); 119 } else { 120 *c = one + z * (q1 + z * (q2 + z * (q3 + z * (q4 + z * 121 (q5 + z * (q6 + z * (q7 + z * q8))))))); 122 t = z * (p1 + z * (p2 + z * (p3 + z * (p4 + z * (p5 + 123 z * (p6 + z * (p7 + z * p8))))))); 124 } 125 126 t = y + x * t; 127 return (x + t); 128 } 129 j = (ix + 0x400) & 0x7ffff800; 130 i = (j - 0x3ffc4000) >> 11; 131 #if defined(_BIG_ENDIAN) 132 pt[0] = j; 133 #else 134 ITOX(j, pt); 135 #endif 136 if (hx > 0) 137 x = y - (t - x); 138 else 139 x = (-y) - (t + x); 140 a1 = _TBL_sinl_hi[i]; 141 z = x * x; 142 t = z * (qq1 + z * (qq2 + z * (qq3 + z * (qq4 + z * qq5)))); 143 w = x * (one + z * (pp1 + z * (pp2 + z * (pp3 + z * (pp4 + z * 144 pp5))))); 145 a2 = _TBL_cosl_hi[i]; 146 t2 = _TBL_cosl_lo[i] - (a1 * w - a2 * t); 147 *c = a2 + t2; 148 t1 = a2 * w + a1 * t; 149 t1 += _TBL_sinl_lo[i]; 150 if (hx < 0) 151 return (-a1 - t1); 152 else 153 return (a1 + t1); 154 } | 80 /* 81 * 82 * |cos(x) - (1+q1*x^2+...+ q8*x^16)| <= 2^-117.11 for |x|<= 0.15625 83 */ 84 q1 = -4.999999999999999999999999999999756416975e-0001L, 85 q2 = 4.166666666666666666666666664006066577258e-0002L, 86 q3 = -1.388888888888888888888877700363937169637e-0003L, 87 q4 = 2.480158730158730158494468463031814083559e-0005L, 88 q5 = -2.755731922398586276322819250356005542871e-0007L, 89 q6 = 2.087675698767424261441959760729854017855e-0009L, 90 q7 = -1.147074481239662089072452129010790774761e-0011L, 91 q8 = 4.777761647399651599730663422263531034782e-0014L; 92 /* INDENT ON */ 93 long double 94 __k_sincosl(long double x, long double y, long double *c) { 95 long double a1, a2, t, t1, t2, z, w; 96 int *pt = (int *) &t, *px = (int *) &x; 97 int i, j, hx, ix; 98 99 t = 1.0; 100 #if defined(__i386) || defined(__amd64) 101 XTOI(px, hx); 102 #else 103 hx = px[0]; 104 #endif 105 ix = hx & 0x7fffffff; 106 if (ix < 0x3ffc4000) { 107 if (ix < 0x3fc60000) 108 if (((int) x) == 0) { 109 *c = one; 110 return (x); 111 } /* generate inexact */ 112 z = x * x; 113 114 if (ix < 0x3ff80000) { 115 *c = one + z * (qq1 + z * (qq2 + z * (qq3 + z * (qq4 + 116 z * qq5)))); 117 t = z * (p1 + z * (p2 + z * (p3 + z * (p4 + z * (p5 + 118 z * p6))))); 119 } else { 120 *c = one + z * (q1 + z * (q2 + z * (q3 + z * (q4 + z * 121 (q5 + z * (q6 + z * (q7 + z * q8))))))); 122 t = z * (p1 + z * (p2 + z * (p3 + z * (p4 + z * (p5 + 123 z * (p6 + z * (p7 + z * p8))))))); 124 } 125 126 t = y + x * t; 127 return (x + t); 128 } 129 j = (ix + 0x400) & 0x7ffff800; 130 i = (j - 0x3ffc4000) >> 11; 131 #if defined(__i386) || defined(__amd64) 132 ITOX(j, pt); 133 #else 134 pt[0] = j; 135 #endif 136 if (hx > 0) 137 x = y - (t - x); 138 else 139 x = (-y) - (t + x); 140 a1 = _TBL_sinl_hi[i]; 141 z = x * x; 142 t = z * (qq1 + z * (qq2 + z * (qq3 + z * (qq4 + z * qq5)))); 143 w = x * (one + z * (pp1 + z * (pp2 + z * (pp3 + z * (pp4 + z * 144 pp5))))); 145 a2 = _TBL_cosl_hi[i]; 146 t2 = _TBL_cosl_lo[i] - (a1 * w - a2 * t); 147 *c = a2 + t2; 148 t1 = a2 * w + a1 * t; 149 t1 += _TBL_sinl_lo[i]; 150 if (hx < 0) 151 return (-a1 - t1); 152 else 153 return (a1 + t1); 154 } |