mathx86floating-pointtrigonometryx87

What is the error of trigonometric instructions on x86?


Where can I find the information about error ranges for trigonometric function instructions on x86 processors, like fsincos?


Solution

  • What you ask is rarely an interesting question, and most likely you really want to know something different. So let me answer different questions first:

    How to calculate trigonometric function to a certain accuracy?

    Just use a longer datatype. With x86, if you need the result with double accuracy, do an 80-bit extended double calculation and you are on the safe side.

    How to get platform-independent accuracy?

    You need a specialized software solution for this, like MPFR

    That said, let me come back to your original question. Short answer: for small operands it should be typically within 1 ulp. For larger operands it's getting worse. The only way to find out for sure is to test this for yourself, like this guy did. There is no reliable information from the processor vendors.