User Guide

x87 Floating-Point Programming 245
24592—Rev. 3.15—November 2009 AMD64 Technology
ZE, DE, IE), which are reported in the x87 status word as described in “x87 Status Word Register
(FSW)” on page 241. A bit masks its exception type when set to 1, and unmasks it when cleared to 0.
Masking a type of exception causes the processor to handle all subsequent instances of the exception
type in a default way. Unmasking the exception type causes the processor to branch to the #MF
exception service routine when an exception occurs. For details about the processor’s responses to
masked and unmasked exceptions, see “x87 Floating-Point Exception Causes” on page 279.
Precision Control (PC). Bits 9–8. Software can set this field to specify the precision of x87 floating-
point calculations, as shown in Table 6-1. Details on each precision are given in “Data Types” on
page 250. The default precision is double-extended-precision. Precision control affects only the
FADDx, FSUBx, FMULx, FDIVx, and FSQRT instructions. For further details on precision, see
“Precision” on page 260.
Rounding Control (RC). Bits 11–10. Software can set this field to specify how the results of x87
instructions are to be rounded. Table 6-2 lists the four rounding modes, which are defined by the IEEE
754 standard.
Round-to-nearest is the default rounding mode. It provides a statistically unbiased estimate of the true
result, and is suitable for most applications. Rounding modes apply to all arithmetic operations except
comparison and remainder. They have no effect on operations that produce not-a-number (NaN)
results. For further details on rounding, see “Rounding” on page 260.
Table 6-1. Precision Control (PC) Summary
PC Value
(binary)
Data Type
00 Single precision
01 reserved
10 Double precision
11 Double-extended precision (default)
Table 6-2. Types of Rounding
RC Value Mode Type of Rounding
00
(default)
Round to nearest
The rounded result is the representable value closest to
the infinitely precise result. If equally close, the even
value (with least-significant bit 0) is taken.
01 Round down
The rounded result is closest to, but no greater than, the
infinitely precise result.
10 Round up
The rounded result is closest to, but no less than, the
infinitely precise result.
11
Round toward
zero
The rounded result is closest to, but no greater in
absolute value than, the infinitely precise result.