Do your calculations with doubles, then cast your parameters to the graphics objects as integers. The computer can't draw pixels more accurately than integer increments.