We now compute which items to show using integers instead of floating point, avoiding rounding errors.