Refactor is_zero()

Use a simple loop instead of unrolling the loop by hand.
Add accuracy and # of iterations as parameters