GCC/Clang can optimize to calculate sin(x) and cos(x) at once, when the both are closely called on the same argument.
Similar optimization is possible for __sinpi(x) and __cospi(x) if available, which calculate arguments in radian, i.e. sin(x*M_PI) and cos(x*M_PI) respectively.
Optimize sin/cos
GCC/Clang can optimize to calculate
sin(x)andcos(x)at once,when the both are closely called on the same argument.
Similar optimization is possible for
__sinpi(x)and__cospi(x)if available, which calculate arguments in radian, i.e.
sin(x*M_PI)andcos(x*M_PI)respectively.