Be aware that at least the Intel x86 architecture has an FSINCOS instruction. The ELI5 of that is that the CPU does the hard work in a single operation, meaning the C function isn’t doing anything interesting. FSINCOS is faster than running both FSIN and FCOS.
Of course the CPU isn’t magic and must be doing similar things internally to what a C function would be doing, although more efficiently. There is some commonality in computing the sine and cosine which both CPU instructions of C functions can take advantage of. The details depend on how they’re implemented.
Latest Answers