Type conversion. Numbers are automatically promoted to a more inclusive type if no
information is lost. For example, in the expression 1 + 2.5 , the 1 is promoted to the
double value 1.0 and the expression evaluates to the double value 3.5 . A cast is a type
name in parentheses within an expression, a directive to convert the following value
into a value of that type. For example (int) 3.7 is 3 and (double) 3 is 3.0. Note that
casting to an int is truncation instead of rounding—rules for casting within complicated
expressions can be intricate, and casts should be used sparingly and with care. A
best practice is to use expressions that involve literals or variables of a single type.