midpoint arithmetic