calculate the ratio