/* 0 <= x <= pi/4 */ BX_CPP_INLINE float128 poly_cos(float128 x, float_status_t &status) { // 2 4 6 8 10 12 14 // x x x x x x x // cos (x) ~ 1 - --- + --- - --- + --- - ---- + ---- - ---- // 2! 4! 6! 8! 10! 12! 14! // // 3 3 // -- 4k -- 4k+2 // p(x) = > C * x > 0 q(x) = > C * x < 0 // -- 2k -- 2k+1 // k=0 k=0 // // 2 // cos(x) ~ [ p(x) + x * q(x) ] // return EvenPoly(x, cos_arr, COS_ARR_SIZE, status); }
float128 OddPoly(float128 x, float128 *arr, unsigned n) { return float128_mul(x, EvenPoly(x, arr, n)); }