Replaced reciprical division with long division to remove dependency of long math library