This preview shows page 1. Sign up to view the full content.
Unformatted text preview: QNaN FloatingPoint Indefinite For the floatingpoint data type encodings (singleprecision, doubleprecision, and doubleextendedprecision), one unique encoding (a QNaN) is reserved for representing the special value QNaN floatingpoint indefinite. The x87 FPU and the SSE/SSE2/SSE3 extensions return these indefinite values as responses to some masked floatingpoint exceptions. Table 43 shows the encoding used for the QNaN floatingpoint indefinite. 4.8.4 Rounding When performing floatingpoint operations, the processor produces an infinitely precise floatingpoint result in the destination format (singleprecision, doubleprecision, or double extendedprecision floatingpoint) whenever possible. However, because only a subset of the numbers in the real number continuum can be represented in IEEE Standard 754 floatingpoint formats, it is often the case that an infinitely precise result cannot be encoded exactly in the format of the destination operand. For example, the following value (a) has a 24bit fraction. The leastsignificant bit of this fraction (the underlined bit) cannot be encoded exactly in the singleprecision format (which has only a 23bit fraction): (a) 1.0001 0000 1000 0011 1001 0111E2 101 To round this result (a), the processor first selects two representable fractions b and c that most closely bracket a in value (b < a < c). (b) 1.0001 0000 1000 0011 1001 011E2 101 (c) 1.0001 0000 1000 0011 1001 100E2 101 422 Vol. 1 DATA TYPES The processor then sets the result to b or to c according to the selected rounding mode. Rounding introduces an error in a result that is less than one unit in the last place (the least significant bit position of the floatingpoint value) to which the result is rounded. The IEEE Standard 754 defines four rounding modes (see Table 48): round to nearest, round up, round down, and round toward zero. The default rounding mode (for the Intel 64 and IA32 architectures) is round to nearest. This mode provides the most accurate and statistically unbiased estimate of the true result and is suitable for most applications. Table 48. Rounding Modes and Encoding of Rounding Control (RC) Field
Rounding Mode Round to nearest (even) Round down (toward ) Round up (toward +) RC Field Setting 00B Description Rounded 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 leastsignificant bit of zero). Default Rounded result is closest to but no greater than the infinitely precise result. Rounded result is closest to but no less than the infinitely precise result. Rounded result is closest to but no greater in absolute value than the infinitely precise result. 01B 10B Round toward 11B zero (Truncate) The round up and round down modes are termed directed rounding and can be used to implement interval arithmetic. Interval arithmetic is used to determine upper and lower bounds for the true result of a multistep computation,...
View
Full
Document
 Winter '11
 Watlins

Click to edit the document details