A rational number generic function