inter

OVERVIEW OF NUMERIC PROCESSING

Pseudo zero operands behave like unnormals, except in the following cases where they produce the same results as true zeros:

Compare and test instructions

FRNDINT (round to integer)

Division, where the dividend is either a true zero or apseudo zero (the divisor is a pseudo zero)

In addition and subtraction of a pseudo zero and a true zero or another pseudo zero, the pseudo zeroes) behaves like unnormals, except for the determination of the result's sign. The sign is determined as shown in table 1-10 for two true zero operands.

INFINITY

The real formats support signed representations of infinities. These values arc encoded with a biased exponent of all ones and a significand of I,:lOO... OO; if the infinity is in a register, it is tagged special. The significand distinguishes infinities from NANs, including real indefinite.

A programmer may code an infinity, or it may be created by the NPX as its masked response to an overflow or a zero divide exception. Note that when rounding is up or down, the masked response may create the largest valid value representable in the destination rather than infinity. See table 1-11 for details. As operands, infinities behave somewhat differently depending on how the infinity control field in the control word is set (see table 1-12). When the projective model of infinity is selected, the infini- ties behave as a single unsigned representation; because of this, infinity cannot be compared with any value except infinity. In affine mode, the signs of the infinities are observed, and comparisons are possible.

NaN (NOT A NUMBER)

A NaN (Not a Number) is a member of a class of special values that exist in the real formats only. A NaN has an exponent of 11..11B, may have either sign, and may have any significand except I,:lOO.. OOB, which is assigned to the infinities. A NaN in a register is tagged special.

The 80287 will generate the special NaN, real indefinite, as its masked response to an invalid operation exception. This NaN is signed negative; its significand is encoded 1,:l100.. 00. All other NaNs represent programmer-created values.

Whenever the NPX uses an operand that is a NaN, it signals an invalid operation exception in its status word. If this exception is masked in the 80287 control word, the 80287's masked exception response is to return the NaN as the operation result. If both operands of an instruction are NaNs, the result is the NaN with the larger absolute value. In this way, a NaN that enters a computation propa- gates through the computation and will eventually be delivered as the final result. Note, however, that the transcendental instructions do not check their operands, and a NaN will produce an undefined result.

By unmasking the invalid operation exception, the programmer can use NaNs to trap to the exception handler. The generality of this approach and the large number of NaN values that are available provide the sophisticated programmer with a tool that can be applied to a variety of special situations.

For example, a compiler could use NaNs as references to uninitialized (real) array elements. The compiler could preinitialize each array element with a NaN whose significand contained the index (relative position) of the element. If an application program attempted to access an element that it had not initialized, it would use the NaN placed there by the compiler. If the invalid operation exception were unmaskcd, an interrupt would occur, and the exception handler would be invoked. The exception

1-25

Page 377
Image 377
Intel 80286, 80287 manual Infinity