You must consider this:
- The question whether a physical system follows a particular law is not a "yes or no" question. There is always an error when you compare what you measure with what the law predicts. The error can be at the 17th digit, but it's still there. Let me quote a very insightful passage by H. Jeffreys about this:
It is not true that observed results agree exactly with the predictions made by the laws actually used. The most that the laws do is to predict a variation that accounts for the greater part of the observed variation; it never accounts
for the whole. The balance is called 'error' and usually quickly forgotten or altogether disregarded in physical writings, but its existence compels us to say that the laws of applied mathematics do not express the whole of the variation. Their justification cannot be exact mathematical agreement, but only a partial one depending on what fraction of the observed variation in one quantity is accounted for by the variations of the others. [...] A physical law, for practical use, cannot be merely a statement of exact predictions; if it was it would invariably be wrong and would be rejected at the next trial. Quantitative prediction must always be prediction within a margin of uncertainty; the amount of this margin will be different in different cases[...]
The existence of errors of observation seems to have escaped the attention of many philosophers that have discussed the uncertainty principle; this is perhaps because they tend to get their notions of physics from popular writings, and not from works on the combination of observations.
(Theory of Probability, 3rd ed. 1983, §I.1.1, pp. 13–14).
The error can be different in different ranges of the quantities you're measuring.
When trying to guess a physical law, scientists often consider the simplest mathematical expression that's not too far from the data.
The "ideal gas law" is very accurate in the range where the temperature $T$ is high, the pressure $p$ is low, and the mass density $1/V$ (inverse volume) is low. In these ranges the law is very realistic. If you 3D-plot various measurements of $(p,V,T)$ for a fixed amount of a real gas, you'll see that a curved surface given by $pV/T=\text{const}$ fits the points having large $T$, low $p$, low $1/V$ very accurately. "Real" gases are very "ideal" in those ranges.
Moreover, the law involves simple multiplication and division: $pV/T$, so it's one of the first a scientist would try to fit the points.
Finally, the law wasn't just suggested by fitting, but also by more general physical and philosophical principles and beliefs. Take a look at
S. G. Brush: The Kind of Motion We Call Heat (2 volumes, North-Holland 1986)
for a very insightful presentation of the history of this and other laws.