title: Fastest implementation of sine, cosine and square root in C++ (doesn't need to be much accurate)
body: <p>I am googling the question for past hour, but there are only points to Taylor Series or some sample code that is either too slow or does not compile at all. Well, most answer I've found over Google is "Google it, it's already asked", but sadly <em>it's not</em>...</p>
  
  <p>I am profiling my game on low-end Pentium 4 and found out that ~85% of execution time is wasted on calculating sinus, cosinus and square root (from standard C++ library in Visual Studio), and this seems to be heavily CPU dependent (on my I7 the same functions got only 5% of execution time, and the game is <em>waaaaaaaaaay</em> faster). I cannot optimize this three functions out, nor calculate both sine and cosine in one pass (there interdependent), but I don't need too accurate results for my simulation, so I can live with faster approximation.</p>
  
  <p>So, the question: What are the fastest way to calculate sine, cosine and square root for float in C++?</p>
  
  <p><strong>EDIT</strong>
  Lookup table are more painful as resulting Cache Miss is way more costly on modern CPU than Taylor Series. The CPUs are just so fast these days, and cache is not.</p>
  
  <p>I made a mistake, I though that I need to calculate several factorials for Taylor Series, and I see now they can be implemented as constants.</p>
  
  <p>So the updated question: is there any speedy optimization for square root as well?</p>
  
  <p><strong>EDIT2</strong></p>
  
  <p>I am using square root to calculate distance, not normalization - can't use fast inverse square root algorithm (as pointed in comment: <a href="http://en.wikipedia.org/wiki/Fast_inverse_square_root" rel="noreferrer">http://en.wikipedia.org/wiki/Fast_inverse_square_root</a></p>
  
  <p><strong>EDIT3</strong></p>
  
  <p>I also cannot operate on squared distances, I need exact distance for calculations</p>