Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int fp_sin(int x)
- {
- int result = 0;
- int x3 = 0;
- int x5 = 0;
- int x7 = 0;
- x3 = fp_mul(fp_mul(x, x), x);
- x5 = fp_mul(fp_mul(x, x), x3);
- x7 = fp_mul(fp_mul(x, x), x5);
- x3 = fp_div(x3, int_to_fp(6));
- x5 = fp_div(x5, int_to_fp(120));
- x7 = fp_div(x7, int_to_fp(5040));
- result = x - x3 - x5 -x7;
- return (result);
- }
- int fp_cos(int x)
- {
- int result = 0;
- result = fp_sin(x + fp_div(FP_PI, int_to_fp(2)));
- return (result);
- }
Add Comment
Please, Sign In to add comment