The deviation from ideal behaviour can be measured in terms of compressibility factor Z, which is the ratio of product PV and nRT.
Mathematically,
Z = PV/nRT
For ideal gas, Z = 1 at all temperatures and pressures because PV = n RT
At intermediate pressure, most gases have z < 1, because gases show ideal behaviour when the volume occupied is large so that the volume of the molecules can be neglected in comparison to the volume of gas. Also, gases have some force of attraction between the molecules.