Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float cos(float x, int n)
- {
- int a = 8*n - 6;
- int b = 4*n*n - 2*n; // 2n(2n-1)
- float s = 1;
- int i;
- x = x*x; //x²
- for(i=0;i<n;i++)
- {
- s = 1 - x*s/b;
- b -= a;
- a -= 8;
- }
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment