Consider the following code:
\documentclass{article}
\usepackage{booktabs,pgf}
\begin{document}
\pgfmathsetlengthmacro{\ratio}{\the\textwidth/4}
\hrulefill \\
\begin{tabular}{@{}llll@{}}
\toprule
\makebox[\ratio][l]{xx}&\makebox[\ratio][l]{1} &\makebox[\ratio][l]{2}&\makebox[\ratio][l]{3}\\
\makebox[\ratio][l]{xx}&\makebox[\ratio][l]{1} &\makebox[\ratio][l]{2}&\makebox[\ratio][l]{3}\\
\bottomrule
\end{tabular}
\end{document}
with output

How can I determine \ratio such that the table fills (exactly) the textwidth of the page? As seen, currently the \ratio is too large such that the table becomes wider than the text width.

