User Guide

132 128-Bit Media and Scientific Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
floating-point-to-integer data conversion overflows its destination integer data type, and IE exceptions
are masked, the integer indefinite value is returned as the result.
Table 4-7 shows the encodings of the indefinite values for each data type. For floating-point numbers,
the indefinite value is a special form of QNaN. For integers, the indefinite value is the largest
representable negative twos-complement number, 80...00h. (This value is the largest representable
negative number, except when a masked IE exception occurs, in which case it is generated as the
indefinite value.)
4.4.9 Floating-Point Rounding
Bits 14–13 of the MXCSR control and status register (“MXCSR Register” on page 117) comprise the
floating-point rounding control (RC) field, which specifies how the results of floating-point
computations are rounded. Rounding modes apply to most arithmetic operations. When rounding
occurs, the processor generates a precision exception (PE). Rounding is not applied to operations that
produce NaN results.
The IEEE 754 standard defines the four rounding modes as shown in Table 4-8.
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
Table 4-7. Indefinite-Value Encodings
Data Type Indefinite Encoding
Single-Precision Floating-Point FFC0_0000h
Double-Precision Floating-Point FFF8_0000_0000_0000h
16-Bit Integer 8000h
32-Bit Integer 8000_0000h
64-Bit Integer 8000_0000_0000_0000h
Table 4-8. 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.