Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
Vol. 1 4-21
DATA TYPES
above the ends of the real number line. This space includes any value with the
maximum allowable biased exponent and a non-zero fraction (the sign bit is ignored
for NaNs).
The IA-32 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 floating-point invalid-operation 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
floating-point operation.
4.8.3.5 Operating on SNaNs and QNaNs
When a floating-point 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 genera-
tion of a floating-point invalid operating exception, depending on the following rules:
• If one of the source operands is an SNaN and the floating-point invalid-operating
exception is not masked (see Section 4.9.1.1, “Invalid Operation Exception
(#I)”), the a floating-point invalid-operation exception is signaled and no result is
stored in the destination operand.
• If either or both of the source operands are NaNs and floating-point invalid-
operation exception is masked, the result is as shown in Table 4-7. When an
SNaN is converted to a QNaN, the conversion is handled by setting the most-
significant fraction bit of the SNaN to 1. Also, when one of the source operands is
an SNaN, the floating-point invalid-operation 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
floating-point invalid-operation exception (see Tables 8-10 and 11-1), the result
is commonly an SNaN source operand converted to a QNaN or the QNaN floating-
point indefinite value.
Any exceptions to the behavior described in Table 4-7 are described in Section
8.5.1.2, “Invalid Arithmetic Operand Exception (#IA),” and Section 11.5.2.1, “Invalid
Operation Exception (#I).”