be careful: are those value integers or floats?
if they are integers this might lead to ratio == 0