This preview shows page 1. Sign up to view the full content.
Unformatted text preview: s a biased exponent greater than the largest allowable exponent for the selected result format. 4.8.3.4 NaNs Since NaNs are nonnumbers, they are not part of the real number line. In Figure 412, the encoding space for NaNs in the floatingpoint formats is shown Vol. 1 419 DATA TYPES above the ends of the real number line. This space includes any value with the maximum allowable biased exponent and a nonzero fraction (the sign bit is ignored for NaNs). The IA32 architecture defines two classes of NaNs: quiet NaNs (QNaNs) and signaling NaNs (SNaNs). A QNaN is a NaN with the most significant fraction bit set; an SNaN is a NaN with the most significant fraction bit clear. QNaNs are allowed to propagate through most arithmetic operations without signaling an exception. SNaNs generally signal a floatingpoint invalidoperation exception whenever they appear as operands in arithmetic operations. SNaNs are typically used to trap or invoke an exception handler. They must be inserted by software; that is, the processor never generates an SNaN as a result of a floatingpoint operation. 4.8.3.5 Operating on SNaNs and QNaNs When a floatingpoint operation is performed on an SNaN and/or a QNaN, the result of the operation is either a QNaN delivered to the destination operand or the generation of a floatingpoint invalid operating exception, depending on the following rules: If one of the source operands is an SNaN and the floatingpoint invalidoperating exception is not masked (see Section 4.9.1.1, "Invalid Operation Exception (#I)"), the a floatingpoint invalidoperation exception is signaled and no result is stored in the destination operand. If either or both of the source operands are NaNs and floatingpoint invalidoperation exception is masked, the result is as shown in Table 47. When an SNaN is converted to a QNaN, the conversion is handled by setting the mostsignificant fraction bit of the SNaN to 1. Also, when one of the source operands is an SNaN, the floatingpoint invalidoperation exception flag it set. Note that for some combinations of source operands, the result is different for x87 FPU operations and for SSE/SSE2/SSE3 operations. When neither of the source operands is a NaN, but the operation generates a floatingpoint invalidoperation exception (see Tables 810 and 111), the result is commonly an SNaN source operand converted to a QNaN or the QNaN floatingpoint indefinite value. Any exceptions to the behavior described in Table 47 are described in Section 8.5.1.2, "Invalid Arithmetic Operand Exception (#IA)," and Section 11.5.2.1, "Invalid Operation Exception (#I)." 420 Vol. 1 DATA TYPES Table 47. Rules for Handling NaNs
Source Operands SNaN and QNaN Result1 x87 FPU  QNaN source operand. SSE/SSE2/SSE3  First operand (if this operand is an SNaN, it is converted to a QNaN) Two SNaNs x87 FPUSNaN source operand with the larger significand, converted into a QNaN SSE/SSE2/SSE3  First operand converted...
View
Full
Document
This note was uploaded on 10/01/2013 for the course CPE 103 taught by Professor Watlins during the Winter '11 term at Mississippi State.
 Winter '11
 Watlins

Click to edit the document details