9-8
PROGRAMMING WITH THE STREAMING SIMD EXTENSIONS
9.1.8.Rounding Control Field
The rounding control (RC) field of MXCSR (bits 13 and 14) controls how the results of floating-
point instructions are rounded. Four rounding modes are supported: round to nearest, round up,
round down, and round toward zero (refer to Table 9-3). Round to nearest is the default rounding
mode and is suitable for most applications. It provides the most accurate and statistically unbi-
ased estimate of the true result.
Table 9-3. Rounding Control Field (RC)
The round up and round down modes are termed directed rounding and can be used to imple-
ment interval arithmetic. Interval arithmetic is used to determine upper and lower bounds for the
true result of a multistep computation, when the intermediate results of the computation are
subject to rounding.
The round toward zero mode (sometimes called the chop mode) is commonly used when
performing integer arithmetic with the processor.
9.1.9.Flush-To-Zero
Turning on the Flush-To-Zero mode has the following effects during underflow situations:
Zero results are returned with the sign of the true result
Precision and underflow exception flags are set
The IEEE mandated masked response to underflow is to deliver the denormalized result (i.e.,
gradual underflow); consequently, the Flush-To-Zero mode is not compatible with IEEE Stan-
dard 754. It is provided primarily for performance reasons. At the cost of a slight precision loss,
faster execution can be achieved for applications where underflows are common. Underflow for
Flush-To-Zero is defined to occur when the exponent for a computed result, prior to denormal-
ization scaling, falls in the denormal range; this is regardless of whether a loss of accuracy has
occurred. Unmasking the underflow exception takes precedence over Flush-To-Zero mode; this
means that an exception handler will be invoked for a Streaming SIMD Extensions instruction
that generates an underflow condition while this exception is unmasked, regardless of whether
Flush-To-Zero is enabled.
Rounding
Mode
RC Field
Setting
Description
Round to
nearest (even)
00BRounded result is the closest to the infinitely precise result. If two values
are equally close, the result is the even value (that is, the one with the
least-significant bit of zero).
Round down
(toward
??
)
01BRounded result is close to but no greater than the infinitely precise
result.
Round up
(toward
+?
)
10BRounded result is close to but no less than the infinitely precise result.
Round toward
zero (Truncate)
11BRounded result is close to but no greater in absolute value than the
infinitely precise result.