The Difference Between x87 Instructions FSIN, FCOS, FSINCOS, and FPTAN and Their Mathematical Counterparts

ID 660346
Updated 1/11/2016
Version Latest




In the early 1980s, the Intel® 8087 Math Coprocessor introduced hardware support for a small set of elementary transcendental functions (trigonometric, inverse trigonometric, exponential, and logarithmic), accessible through x87 instructions. In the 1990s Intel replaced the 8087’s CORDIC-based approximations of the elementary transcendental functions with polynomial-based approximations. These newer polynomial-based approximations provide a large degree of backwards compatibility with the CORDIC based approximations by approximating precisely the same functions, but with greater overall accuracy and speed.

The purpose of this paper is to inform users of many of the implementation details of the x87 trigonometric instructions. If users find that the x87 elementary transcendental instructions are not adequate for their needs, they should consider using the software libraries of transcendental functions available through the Intel® C++ Compiler and Intel® Fortran Compiler, the Intel® Math Kernel Library (Intel® MKL) product, or libraries from other providers. Just as double precision arithmetic is provided to users when single precision floating-point arithmetic is not adequate, so these software library functions provide more accurate approximations when the x87 instructions are not adequate. 

The paper explains that FSIN(x), FCOS(x), FSINCOS(x) and FPTAN(x) are approximations of the corresponding mathematical functions of argument (x • π/p), and not of argument (x). Therefore they can only be used to approximate the mathematical functions sin(x), cos(x), and tan(x) on a limited domain, outside of which a more accurate argument reduction technique is necessary in order to contain the errors, or, alternatively, accurate software implementations of these mathematical functions may to be used.

The limitations of using a 68-bit approximation of π are also explained in the Intel® 64 and IA-32 Architectures Software Developer Manuals, available online at See Vol. 1, section 8.3.8 “Approximation of Pi”, and the instruction manual pages in Vol. 2A, section 3.2.

For the complete article, please open the attached PDF file.