7-55
FLOATING-POINT UNIT
FSTP instructions), where a within-range value in a data register is stored in memory in a single-
or double-real format. The overflow threshold range for the single-real format is
?
1.0
?
2
128
to
1.0
?
2
128
; the range for the double-real format is
?
1.0
?
2
1024
to 1.0
?
2
1024
.
The numeric overflow exception cannot occur when overflow occurs when storing values in an
integer or BCD integer format. Instead, the invalid-arithmetic-operand exception is signaled.
The flag (OE) for the numeric overflow exception is bit 3 of the FPU status word, and the mask
bit (OM) is bit 3 of the FPU control word.
When a numeric overflow exception occurs and the exception is masked, the FPU sets the OE
flag and returns one of the values shown in Table 7-23. The value returned depends on the
current rounding mode of the FPU (refer to Section 7.3.4.3., Rounding Control Field).
.
The action that the FPU takes when numeric overflow occurs and the numeric overflow excep-
tion is not masked, depends on whether the instruction is supposed to store the result in memory
or on the register stack.
If the destination is a memory location, the OE flag is set and a software exception handler is
invoked (refer to Section 7.7.3., Software Exception Handling). The top-of-stack pointer
(TOP) and source and destination operands remain unchanged.
If the destination is the register stack, the exponent of the rounded result is divided by 2
24576
and
the result is stored along with the significand in the destination operand. Condition code bit C1
in the FPU status word (called in this situation the round-up bit) is set if the significand was
rounded upward and cleared if the result was rounded toward 0. After the result is stored, the
OE flag is set and a software exception handler is invoked.
The scaling bias value 24,576 is equal to 3
?
2
13
. Biasing the exponent by 24,576 normally trans-
lates the number as nearly as possible to the middle of the extended-real exponent range so that,
if desired, it can be used in subsequent scaled operations with less risk of causing further
exceptions.
When using the FSCALE instruction, massive overflow can occur, where the result is too large
to be represented, even with a bias-adjusted exponent. Here, if overflow occurs again, after the
result has been biased, a properly signed
?
is stored in the destination operand.
Table 7-23. Masked Responses to Numeric Overflow
Rounding Mode
Sign of True Result
Result
To nearest
+
+
?
?
Toward
?
+
Largest finite positive number
?
Toward +
?
+
+
?
Largest finite negative number
Toward zero
+
Largest finite positive number
Largest finite negative number