ensure numerator and denominator are coprime