Java Reference
In-Depth Information
quiet NaN, even if both operands are signaling NaNs. Since the only re-
quirement of the NaN encoding is that the exponent be formed with all
one-bits and that the significand be non-zero, there is an abundant num-
ber of possible NaN combinations, even in the smaller formats. For exam-
ple, in the single format which uses a 23-bit significand, there are over
eight million possible encodings for positive NaNs, and as many for nega-
tive NaNs. How these encodings are assigned to the various signaling and
non-signaling NaNs is also left to the implementation.
Exceptions
IEEE 754 requires the identification and signaling of five different error
conditions:
1. Invalid operation
2. Division by zero
3. Overflow
4. Underflow
5. Inexact result
The signaling of an exception condition is performed by setting a flag,
executing a trap routine, or both. The default response is to bypass the
trap routine. The trap (which is different for each exception condition)
transfers control to the user's error handler. The implementation must
provide a different error flag for each exception.
Invalid operation exception
According to IEEE 754 the following conditions generate an invalid opera-
tion exception:
1. An operation on a signaling NaN
2. Additionorsubtractionoperationsinwhichoneorbothoperandsareinfin-
ities
3. Multiplication of 0 times
4. Division of 0/0 or /
5. Remainder operation, in the form x REM y, in which x =0or y =
6. The square root of a negative number
7. Conversion operations from binary floating-point formats into integer or
decimalformatsthatproducearesultthatcannotbefaithfullyrepresented
8. Comparison operations in which one or both operands are NaNs.
Search WWH ::




Custom Search