User Guide

x87 Floating-Point Programming 237
24592—Rev. 3.15—November 2009 AMD64 Technology
6 x87 Floating-Point Programming
This chapter describes the x87 floating-point programming model. This model supports all aspects of
the legacy x87 floating-point model and complies with the IEEE 754 and 854 standards for binary
floating-point arithmetic. In hardware implementations of the AMD64 architecture, support for
specific features of the x87 programming model are indicated by the CPUID feature bits, as described
in “Feature Detection” on page 278.
6.1 Overview
Floating-point software is typically written to manipulate numbers that are very large or very small,
that require a high degree of precision, or that result from complex mathematical operations, such as
transcendentals. Applications that take advantage of floating-point operations include geometric
calculations for graphics acceleration, scientific, statistical, and engineering applications, and process
control.
6.1.1 Capabilities
The advantages of using x87 floating-point instructions include:
Representation of all numbers in common IEEE-754/854 formats, ensuring replicability of results
across all platforms that conform to IEEE-754/854 standards.
Availability of separate floating-point registers. Depending on the hardware implementation of the
architecture, this may allow execution of x87 floating-point instructions in parallel with execution
of general-purpose and 128-bit media instructions.
Availability of instructions that compute absolute value, change-of-sign, round-to-integer, partial
remainder, and square root.
Availability of instructions that compute transcendental values, including 2
x
-1, cosine, partial arc
tangent, partial tangent, sine, sine with cosine, y*log
2
x, and y*log
2
(x+1). The cosine, partial arc
tangent, sine, and sine with cosine instructions use angular values expressed in radians for
operands and results.
Availability of instructions that load common constants, such as log
2
e, log
2
10, log
10
2, log
e
2, Pi, 1,
and 0.
x87 instructions operate on data in three floating-point formats—32-bit single-precision, 64-bit
double-precision, and 80-bit double-extended-precision (sometimes called extended precision)—as
well as integer, and 80-bit packed-BCD formats.
x87 instructions carry out all computations using the 80-bit double-extended-precision format. When
an x87 instruction reads a number from memory in 80-bit double-extended-precision format, the
number can be used directly in computations, without conversion. When an x87 instruction reads a
number in a format other than double-extended-precision format, the processor first converts the