2 This code casts the result of an integer division operation to double or
4 Doing division on integers truncates the result
5 to the integer value closest to zero. The fact that the result
6 was cast to double suggests that this precision should have been retained.
7 What was probably meant was to cast one or both of the operands to
8 double <em>before</em> performing the division. Here is an example:
14 // Wrong: yields result 0.0
15 double value1 = x / y;
17 // Right: yields result 0.4
18 double value2 = x / (double) y;