Since the function fsin
for computing the sin(x)
function under the x86 dates back to the Pentium era, and apparently it doesn't even use SSE registers, I was wondering if there is a newer and better set of instructions for computing trigonometric functions.
I'm used to code in C++ and do some asm
optimizations, so anything that fits in a pipeline starting from C++, to C to asm will do for me.
Thanks.
I'm under Linux 64 bit for now, with gcc
and clang
( even tough clang doesn't really offer any FPU related optimization AFAIK ).
EDIT
- I have already implemented a
sin
function, it's usually 2 times faster thenstd::sin
even withsse
on. - My function is never slower then
fsin
, even toughfsin
is usually more accurate, but considering thatfsin
never outperforms mysin
implementation, I'll keep mysin
for now, also mysin
is totally portable wherefsin
is for x86 only. - I need this for real time computation, so I'll trade precision for speed, I think that I'll be fine with 4-5 decimals of precision .
- no to a table based approach, I'm not using it, it screws up the cache, makes everything slower, no algorithm based on memory access or lookup tables please.