2 ms·
Note that you can combine the lookup table with the taylor series expansion... And you can even use the same lookup table for each. That means with 2 table l
by londons_explore 3y ago
Note that you can combine the lookup table with the taylor series expansion...
And you can even use the same lookup table for each. That means with 2 table lookups in a 32 entry table, a single multiply and add (and a few bit shifts), you can get ~9 bits of precision in your result, which is fine for most uses. It also probably makes a sin operation take ~1 clock cycle on most superscalar architectures, as long as your workload has sufficient instruction parallelism.
Note that a smaller table typically works out faster because 32 entries fit in the cache, whereas repeated random entry into a 1024 entry table would probably kick a bunch of other stuff out of the cache that you wanted.