Invalid Operation Exception

An invalid operation indicates that an exceptional condition not covered by one of the other exceptions has occurred. An invalid operation can be caused by any of the following situations:

(+--)0.0-(+--)0.0, (+--)0.0*(+--), or (+--)-(+--).

The invalid-operation exception can occur in any of the following functions:

For any of the invalid-operation exceptions, the exception handler is invoked before the top of the stack changes, so the operands are available to the exception handler.

When invalid-operation exceptions are masked, the result of an invalid operation is a quiet NaN. Program execution proceeds normally using the quiet NaN result.

Floating-point Result

The appearance of a quiet NaN as an operand results in a quiet NaN. Execution continues without an error. If both operands are quiet NaNs, the quiet NaN with the larger significand is used as the result. Thus, each quiet NaN is propagated through later floating-point calculations until it is ultimately ignored or referenced by an operation that delivers non-floating-point results.

Formatted Output

On formatted output using a real edit descriptor, the field is filled with the "?" symbols to indicate the undefined (NaN) result. The A, Z, or B edit descriptor results in the ASCII, hexadecimal, or binary interpretation, respectively, of the internal representation of the NaN. No error is signaled for output of a NaN.

Logical Result

By definition, a NaN has no ordinal rank with respect to any other operand, even itself. Tests for equality (.EQ.) and inequality (.NE.) are the only Forrtran relational operations for which results are defined for unordered operands. In these cases, program execution continues without error. Any other logical operation yields an undefined result when applied to NaNs, causing an invalid-operation error. The masked result is unpredictable.

Integer Result

Since no internal NaN representation exists for the INTEGER data type, an invalid-operation error is normally signaled. The masked result is the largest-magnitude negative integer for INTEGER*4 or INTEGER*2. An INTEGER*1 result is the value of an INTEGER*2 intermediate result modulo 256.

Intel® Fortran Compiler provides a method to control the rounding mode, exception handling and other IEEE-related functions of the IA-32 processors using IEEE_FLGS and IEEE_HANDLER library routines from the portability library. For details, see Chapter 2 in the Intel® Fortran Libraries Reference Manual.