title: What is the fastest way to compute sin and cos together?
body: <p>I would like to compute both the sine and co-sine of a value together (for example to create a rotation matrix). Of course I could compute them separately one after another like <code>a = cos(x); b = sin(x);</code>, but I wonder if there is a faster way when needing both values.</p>
  
  <p><strong>Edit:</strong>
  To summarize the answers so far:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/a/2683691"><em>Vlad</em></a> said, that there is the asm command <code>FSINCOS</code> computing both of them (in almost the same time as a call to <code>FSIN</code> alone)</p></li>
  <li><p>Like <a href="https://stackoverflow.com/a/2683963"><em>Chi</em></a> noticed, this optimization is sometimes already done by the compiler (when using optimization flags).</p></li>
  <li><p><a href="https://stackoverflow.com/a/2687338"><em>caf</em></a> pointed out, that functions <code>sincos</code> and <code>sincosf</code> are probably available and can be called directly by just including <code>math.h</code></p></li>
  <li><p><a href="https://stackoverflow.com/a/2683613"><em>tanascius</em></a> approach of using a look-up table is discussed controversial. (However on my computer and in a benchmark scenario it runs 3x faster than <code>sincos</code> with almost the same accuracy for 32-bit floating points.)</p></li>
  <li><p><a href="https://stackoverflow.com/a/2683853"><em>Joel Goodwin</em></a> linked to an interesting approach of an extremly fast approximation technique with quite good accuray (for me, this is even faster then the table look-up)</p></li>
  </ul>