However by accepting a nearly imperceptible slant, we can simplify and just divide i by half the number of pixels and subtracting 1 to normalize between -1 and 1. The value 4e3 was chosen to move the horizon below center. You can play around with these values to see how it effects the result.
Source: City In A Bottle – A 256 Byte Raycasting System | Killed By A Pixel