1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#ifndef __FDLIBM_H__ #include "fdlibm.h" #endif
double __kernel_sin(double x, double y, int iy) { double z, r, v; int32_t ix;
static const double half = 5.00000000000000000000e-01; static const double S1 = -1.66666666666666324348e-01; static const double S2 = 8.33333333332248946124e-03; static const double S3 = -1.98412698298579493134e-04; static const double S4 = 2.75573137070700676789e-06; static const double S5 = -2.50507602534068634195e-08; static const double S6 = 1.58969099521155010221e-10;
GET_HIGH_WORD(ix, x); ix &= IC(0x7fffffff); if (ix < IC(0x3e400000)) { if ((int32_t) x == 0) return x; } z = x * x; v = z * x; r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6))); if (iy == 0) return x + v * (S1 + z * r); else return x - ((z * (half * y - v * r) - y) - v * S1); }
|