Okay... Sin doesn't seem any trickier than Cosine but here goes,
Code:
//Equation for Sin(x)
//Sigma(0, infinity) { -1^n * (x^(2n+1))/(2n+1)! } - Makes me wish vBulletin supported TeX
//Best to do things properly or not at all
int factorial (int n) {
int i;
int result = 1;
if( n > 0 ) {
for( i = 1; i <= n; i++ ) {
result = result * i;
}
}
return result;
}
int taylor_sin (int pos, int x) {
int i;
int term;
int sum = 0;
for( i = 0; i < pos; i++ ) {
term = pow(-1, i) * pow(x,(2 * i + 1)) / factorial(2 * i + 1);
sum = sum + term;
}
}