title: Making a custom Sin() function in Java
body: <p>I have to create the sin function from scratch in my Comp Sci class, and I am getting close to a solution. However, I am still having a few problems. If I put in a value of .5PI or less it works, but otherwise I get the incorrect result. Here is the code I have so far:</p>
  
  <pre><code>double i=1;
  double sinSoFar = 0;
  int term = 1;
  while(i &gt;= .000001)
  {
      i = pow(-1, term + 1) * pow(sinOf, 2*term-1) / factorial(2*term-1);
      sinSoFar=sinSoFar + i;
      term++;
  }
  </code></pre>