Java Reference
In-Depth Information
lose precision because it is replaced by a denormalized number or zero of the same
sign).
Within an FP-strict expression (§ 15.4 ), value set conversion does not provide any choices;
every implementation must behave in the same way:
• If the value is of type float and is not an element of the float value set, then the im-
plementation must map the value to the nearest element of the float value set. This
conversion may result in overflow or underflow.
• If the value is of type double and is not an element of the double value set, then the
implementation must map the value to the nearest element of the double value set.
This conversion may result in overflow or underflow.
Within an FP-strict expression, mapping values from the float-extended-exponent value set
or double-extended-exponent value set is necessary only when a method is invoked whose
declaration is not FP-strict and the implementation has chosen to represent the result of the
method invocation as an element of an extended-exponent value set.
Whether in FP-strict code or code that is not FP-strict, value set conversion always leaves
unchanged any value whose type is neither float nor double .
5.2. Assignment Conversion
Assignment conversion occurs when the value of an expression is assigned (§ 15.26 ) to a
variable: the type of the expression must be converted to the type of the variable.
Assignment contexts allow the use of one of the following:
• an identity conversion (§ 5.1.1 )
• a widening primitive conversion (§ 5.1.2 )
• a widening reference conversion (§ 5.1.5 )
• a boxing conversion (§ 5.1.7 ) optionally followed by a widening reference conver-
sion
• an unboxing conversion (§ 5.1.8 ) optionally followed by a widening primitive con-
version.
If, after the conversions listed above have been applied, the resulting type is a raw type
4.8 ) , unchecked conversion (§ 5.1.9 ) may then be applied.
It is a compile-time error if the chain of conversions contains two parameterized types that
are not in the subtype relation.
Search WWH ::




Custom Search