AMD 250 Computer Hardware User Manual


 
238 x87 Floating-Point Optimizations Chapter 10
25112 Rev. 3.06 September 2005
Software Optimization Guide for AMD64 Processors
10.1 Using Multiplication Rather Than Division
Optimization
If accuracy requirements allow, convert floating-point division by a constant to multiplication by the
reciprocal.
Application
This optimization applies to:
32-bit software
64-bit software
Rationale
Divisors that are powers of two—and their reciprocals—are exactly representable, and therefore do
not cause an accuracy issue, except for the rare case in which the reciprocal overflows or underflows.
Unless such an overflow or underflow occurs, always convert a division by a power of two for
multiplication. Although the AMD Athlon 64 and AMD Opteron processors have high-performance
division, multiplication is significantly faster than division.