Reverse-engineering the Intel 8087's tangent algorithm: beyond CORDIC
Photo via Unsplash
The Intel 8087's tangent algorithm has been the subject of a recent reverse-engineering effort that reveals it wasn't based solely on CORDIC, as commonly believed, but on a hybrid approach that optimized precision and speed. This finding, discussed on Hacker News, isn't just a historical curiosity: it sheds light on how math coprocessors were designed in the 1980s and why the 8087 remains a masterpiece of hardware engineering.
Context: the era of coprocessors
In the early 1980s, Intel released the 8087, the first math coprocessor for the x86 line. Its purpose was to accelerate floating-point operations that the main CPU couldn't handle efficiently. It was assumed to use CORDIC (COordinate Rotation DIgital Computer), a popular algorithm for trigonometric functions. However, analysis of the comments on Hacker News suggests the implementation was more sophisticated.
Details: the real implementation
The study, based on reverse-engineering the microcode, shows that the 8087 employed a lookup table for tangent, combined with interpolation and post-adjustments. It wasn't a simple CORDIC. The table contained 128 entries, and the algorithm used 80-bit floating-point arithmetic to maintain precision. Additionally, it was discovered that the 8087 could compute tangent in just 100 clock cycles, a feat for the time. This contradicted the belief that CORDIC was the only viable method.
Analysis: precision vs. speed
This finding demonstrates that Intel prioritized precision over algorithmic simplicity. While CORDIC is elegant and suitable for limited hardware, the lookup table with interpolation offered a better balance for scientific and engineering applications. The 8087 wasn't just a coprocessor; it was a specialized accelerator that paved the way for future FPUs (floating-point units). The decision not to use CORDIC may have been key to its market success.
Implications: lessons for modern hardware
Today, with AI and high-performance computing, the 8087's lesson still holds: there's no single algorithm that fits all. Modern chip designers, such as those working on GPUs and TPUs, face similar decisions when implementing math functions. Reverse-engineering these systems not only preserves history but inspires new architectures. Perhaps the next breakthrough in energy efficiency will come from revisiting forgotten techniques.
In a world obsessed with innovation, the 8087 reminds us that sometimes the most effective solutions aren't the most elegant, but the ones that best fit the problem.
Source: Hacker News
[weekly newsletter]
Top 10 tech stories every Monday. No spam.