For large arguments, the error of the __sincosf-function becomes
significant (the absolute error is about 4e-4 for arguments of the
order of 1e4).
The error seem to be linear in the argument, and be a 90-degree
Replacing the code:
const float correction = 4.065371168387674e-08f; __sincosf(phi,&s1,&c1); t = t*correction; s = s1 + t*c1; c = c1 - t*s1;
improves the maximum absolute error in he range [-1e4,1e4] bu a
factor of about 100. The cost 3 is instrucitons (one mul and two
maximum absolute error in the [-1e4,1e4] range for the improved code
is about 3.5e-6. The absolute error for small ranges is essentially
unaffected, since the correction is linear.
The resulting error of the improved code does not seem to grow with
the argument (phi), as is the case for the uncorrected __sincosf.
This has been tested on the G80 chip (a 8800GT, a 8800GTS and a
8800GTX with identical results).