Learn AP Comp Sci

Problem of the Day

Thursday, December 25, 2025


Problem:

The Java instruction

System.out.println(100 * 8.3);
is executed, producing the result 830.0000000000001 rather than the expected value of 830.0. This is because

  1. Multiplying an int value and a double value is not allowed
  2. There was an overflow error
  3. There was a rounding error
  4. There was a math error in the central processing unit

Show solution:

The correct answer is c. In the same way that decimal values aren't always perfect representations of a fraction, the boolean math performed by the computer may exhibit rounding errors for the floating point values in a double value.