More Low-level Optimizations (2)

Note that y is now an integer.
Can we represent the fraction as an integer?
After we draw the first pixel (which happens outside our main loop) the correct fraction is:

fraction = 1/2 + dy/dx

If we scale the fraction by 2*dx the following expression results:

scaledFraction = dx + 2*dy

and the incremental update becomes:

scaledFraction += 2*dy         // 2*dx*(dy/dx)

and our test must be modified to reflect the new scaling

if (scaledFraction >= 2*dx) { ... }