Java Reference
In-Depth Information
In other words, in encodings that use an implicit 1-bit in the significand,
the significand for an infinity appears as all zeros. On the other hand, in
encodings with an explicit 1-bit, infinity is represented as 100...00. In
IEEE 754 affine treatment of infinity is achieved by setting the number's
sign bit for negative infinity and clearing it for positive infinity.
Not a number (NaN)
IEEE 754 requires that a number that exceeds the capacity of the destina-
tion format due to overflow or underflow, including the representable
denormals,bereplacedwiththespecialencodingforinfinity.Thereafterin-
finityarithmeticgeneratesexactandvalidresultsontheseoperandsandno
exceptionissignaled,exceptforthespecialconditionsalreadymentioned.
On the other hand, certain operations generate results that are absurd,
unrepresentable, or mathematically undefined; for example, attempts to
perform division by zero, to multiply 0 * , and to calculate the square
root of a negative number. In these cases the standard provides a special
encoding to represent results that are classified as Not a Number (NaN).
The general pattern is an exponent of all 1-bits (as in the encoding for in-
finity) and a non-zero fractional portion of the significand. Note that the
NaN encoding is easily differentiated from the infinity encoding because
infinity requires all zeros in the fractional portion of the significand.
Since these are the only requirements of the standard for a NaN encoding,
implementations are free to use variations of the non-zero significand to
represent different types of NaNs.
Signaling and quiet NaNs
IEEE 754 requires the support of two different types of NaNs: signaling
NaNs and quiet NaNs . The difference between them is that when a signal-
ing NaN appears as an operand in an arithmetic calculation it forces the
generation of an error exception. Quiet NaNs, on the other hand, will si-
lently propagate signaling no error.
In the standard, signaling NaN and quiet NaN encodings are left to the
implementor's discretion. The standard does mention that signaling NaNs
are typically used in representing uninitialized variables, complex infinity
encodings, or other particular enhancements of the implementation. The
signaling mechanism provides a way of detecting an attempt to use NaNs
as numeric operands. It is left to the implementation to decide whether
the simple copying of a signaling NaN generates an error.
According to IEEE 754, signaling NaNs are not to be propagated by the
system. If the result of an operation is a NaN it should be represented as a
Search WWH ::




Custom Search