fix div_i and div_I to floor rather than round towards 0
gcd needs to abs both arguments before calculating