Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
Vol. 1 4-27
DATA TYPES
4.9.1 Floating-Point Exception Conditions
The following sections describe the various conditions that cause a floating-point
exception to be generated and the masked response of the processor when these
conditions are detected. The Intel® 64 and IA-32 Architectures Software Developer’s
Manual, Volumes 3A & 3B, list the floating-point exceptions that can be signaled for
each floating-point instruction.
4.9.1.1 Invalid Operation Exception (#I)
The processor reports an invalid operation exception in response to one or more
invalid arithmetic operands. If the invalid operation exception is masked, the
processor sets the IE flag and returns an indefinite value or a QNaN. This value over-
writes the destination register specified by the instruction. If the invalid operation
exception is not masked, the IE flag is set, a software exception handler is invoked,
and the operands remain unaltered.
See Section 4.8.3.6, “Using SNaNs and QNaNs in Applications,” for information about
the result returned when an exception is caused by an SNaN.
The processor can detect a variety of invalid arithmetic operations that can be coded
in a program. These operations generally indicate a programming error, such as
dividing ∞ by ∞ . See the following sections for information regarding the invalid-
operation exception when detected while executing x87 FPU or SSE/SSE2/SSE3
instructions:
• x87 FPU; Section 8.5.1, “Invalid Operation Exception”
• SIMD floating-point exceptions; Section 11.5.2.1, “Invalid Operation Exception
(#I)”
4.9.1.2 Denormal Operand Exception (#D)
The processor reports the denormal-operand exception if an arithmetic instruction
attempts to operate on a denormal operand (see Section 4.8.3.2, “Normalized and
Denormalized Finite Numbers”). When the exception is masked, the processor sets
the DE flag and proceeds with the instruction. Operating on denormal numbers will
produce results at least as good as, and often better than, what can be obtained
when denormal numbers are flushed to zero. Programmers can mask this exception
so that a computation may proceed, then analyze any loss of accuracy when the final
result is delivered.
When a denormal-operand exception is not masked, the DE flag is set, a software
exception handler is invoked, and the operands remain unaltered. When denormal
operands have reduced significance due to loss of low-order bits, it may be advisable
to not operate on them. Precluding denormal operands from computations can be
accomplished by an exception handler that responds to unmasked denormal-
operand exceptions.