Guest User

Untitled

a guest
Jan 24th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1.  
  2. int fp_sin(int x)
  3. {
  4. int result = 0;
  5. int x3 = 0;
  6. int x5 = 0;
  7. int x7 = 0;
  8.  
  9. x3 = fp_mul(fp_mul(x, x), x);
  10. x5 = fp_mul(fp_mul(x, x), x3);
  11. x7 = fp_mul(fp_mul(x, x), x5);
  12. x3 = fp_div(x3, int_to_fp(6));
  13. x5 = fp_div(x5, int_to_fp(120));
  14. x7 = fp_div(x7, int_to_fp(5040));
  15. result = x - x3 - x5 -x7;
  16. return (result);
  17. }
  18.  
  19. int fp_cos(int x)
  20. {
  21. int result = 0;
  22.  
  23. result = fp_sin(x + fp_div(FP_PI, int_to_fp(2)));
  24.  
  25. return (result);
  26. }
Add Comment
Please, Sign In to add comment