
Chapter 4: 128-Bit Media and Scientific Programming
159
24593—Rev. 3.09—September 2003
AMD 64-Bit Technology
Round to nearest is the default 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: 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 “SIMD Floating-Point
Exception Causes” on page 211.
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)
,
Table 4-9.
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.