Originally Posted by

**StaticKyle**
Okay, I implemented yours, laserlight, and I tested it and the answer that I got with setting the loop count or n to 15 wasn't close to the value that I got from my calculated value.

well in that case try this

Code:

double sine(float x)
{
int i,n;
int sign = -1;
double sum = x,power=x,fact = 1.0,psum=0.0;
for (i = 1; fabs(fabs(sum) - fabs(psum)) > 0.0000000001; ++i)
{
psum=sum;
power = power * x *x;
n = (2*i+1);
fact = fact * n * (n-1);
sum += sign * power/fact;
sign = -sign;
}
printf("n value is %d\n",i);
return sum;
}

the angle is expressed in radians ,Am i right?