I have to create the sin function from scratch in my Comp Sci class, and I think I got it down. But it still has some problems. If I put in a value of .5PI or less it works. Otherwise it doesn't. Any help would be greatly appreciated.
double i=1;
double sinSoFar = 0;
int term = 1;
while(i >= .000001)
{
i = pow(-1, term + 1) * pow(sinOf, 2*term-1) / factorial(2*term-1);
sinSoFar=sinSoFar + i;
term++;
}