Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Modern Intel/AMD processors have instruction <code>FSINCOS</code> for calculating sine and cosine functions simultaneously. If you need strong optimization, perhaps you should use it.</p> <p>Here is a small example: <a href="http://home.broadpark.no/~alein/fsincos.html" rel="noreferrer">http://home.broadpark.no/~alein/fsincos.html</a></p> <p>Here is another example (for MSVC): <a href="http://www.codeguru.com/forum/showthread.php?t=328669" rel="noreferrer">http://www.codeguru.com/forum/showthread.php?t=328669</a></p> <p>Here is yet another example (with gcc): <a href="http://www.allegro.cc/forums/thread/588470" rel="noreferrer">http://www.allegro.cc/forums/thread/588470</a></p> <p>Hope one of them helps. (I didn't use this instruction myself, sorry.)</p> <p>As they are supported on processor level, I expect them to be way much faster than table lookups.</p> <p>Edit:<br> <a href="http://en.wikipedia.org/wiki/X86_instruction_listings" rel="noreferrer">Wikipedia</a> suggests that <code>FSINCOS</code> was added at 387 processors, so you can hardly find a processor which doesn't support it.</p> <p>Edit:<br> <a href="http://developer.intel.com/Assets/PDF/manual/248966.pdf" rel="noreferrer">Intel's documentation</a> states that <code>FSINCOS</code> is just about 5 times slower than <code>FDIV</code> (i.e., floating point division).</p> <p>Edit:<br> Please note that not all modern compilers optimize calculation of sine and cosine into a call to <code>FSINCOS</code>. In particular, my VS 2008 didn't do it that way.</p> <p>Edit:<br> The first example link is dead, but there is <a href="http://web.archive.org/web/20100729204636/http://home.broadpark.no/~alein/fsincos.html" rel="noreferrer">still a version at the Wayback Machine</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload