AMD amd64 architecture User Manual

Page of 336
260
x87 Floating-Point Programming
AMD64 Technology
24592—Rev. 3.15—November 2009
6.3.5 Precision
The Precision control (PC) field comprises bits 9–8 of the x87 control word (“x87 Control Word
Register (FCW)” on page 244). 
This field specifies the precision of floating-point calculations for the
FADDx, FSUBx, FMULx, FDIVx, and FSQRT instructions, as shown in Table 6-11.
The default precision is double-extended-precision. Selecting double-precision or single-precision
reduces the size of the significand to 53 bits or 24 bits, but keeps the exponent in double extended
range. The reduced precision is provided to support the IEEE 754 standard. When using reduced
precision, rounding clears the unused bits on the right of the significand to 0s.
6.3.6 Rounding
The rounding control (RC) field comprises bits 11–10 of the x87 control word (“x87 Control Word
Register (FCW)” on page 244). 
This field specifies how the results of x87 floating-point computations
are rounded. Rounding modes apply to most arithmetic operations but not to comparison or remainder.
They have no effect on operations that produce NaN results.
The IEEE 754 standard defines the four rounding modes as shown in Table 6-12.
Round to nearest is the default (reset) rounding mode. It provides a statistically unbiased estimate of
the true result, and is suitable for most applications. The other rounding modes are directed roundings:
Table 6-11.
Precision Control Field (PC) Values and Bit Precision
PC Field
Data Type
Precision (bits)
00
Single precision
24
1
01
reserved
10
Double precision
53
1
11
Double-extended precision
64
Note:
1. The single-precision and double-precision bit counts include the implied integer bit.
Table 6-12.
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.