AMD amd64 architecture User Manual

Page of 336
x87 Floating-Point Programming
261
24592—Rev. 3.15—November 2009
AMD64 Technology
round up (toward +
∞), round down (toward –∞), and round toward zero. Round up and round down are
used in interval arithmetic, in which upper and lower bounds bracket the true result of a computation.
Round toward zero takes the smaller in magnitude, that is, always truncates.
The processor produces a floating-point result defined by the IEEE standard to be infinitely precise.
This result may not be representable exactly in the destination format, because only a subset of the
continuum of real numbers finds exact representation in any particular floating-point format.
Rounding modifies such a result to conform to the destination format, thereby making the result
inexact and also generating a precision exception (PE), as described in “x87 Floating-Point Exception
Causes” on page 279.
Suppose, for example, the following 24-bit result is to be represented in single-precision format, where
E
2
1010
” represents the biased exponent:
1.0011 0101 0000 0001 0010 0111 E
2
1010
This result has no exact representation, because the least-significant 1 does not fit into the single-
precision format, which allows for only 23 bits of fraction. The rounding control field determines the
direction of rounding. Rounding introduces an error in a result that is less than one unit in the last place
(ulp), that is, the least-significant bit position of the floating-point representation.
6.4
Instruction Summary
This section summarizes the functions of the x87 floating-point instructions. The instructions are
organized here by functional group—such as data-transfer, arithmetic, and so on. More detail on
individual instructions is given in the alphabetically organized “x87 Floating-Point InstructionReference” in Volume 5.
Software running at any privilege level can use any of these instructions, if the CPUID instruction
reports support for the instructions (see “Feature Detection” on page 278). Most x87 instructions take
floating-point data types for both their source and destination operands, although some x87 data-
conversion instructions take integer formats for their source or destination operands.
6.4.1 Syntax
Each instruction has a mnemonic syntax used by assemblers to specify the operation and the operands
to be used for source and destination (result) data. Many of x87 instructions have the following syntax:
MNEMONIC st(j), st(i)
Figure 6-10 on page 262 shows an example of the mnemonic syntax for a floating-point add (FADD)
instruction.