I described how TeX inputs dimensions and handles units in https://tex.stackexchange.com/a/231281 and Why pdf file cannot be reproduced? and possibly at other locations, including some comments which are not always read.
I am using Plain TeX but of course it works exactly the same in LaTeX.
\newdimen\fixed
\fixed 1pt
\newdimen\testA
\newdimen\testB
\testA 0.33333587646484374\fixed
\testB 0.33333587646484375\fixed
\ifdim\testA = \testB
The two dimensions are equal
\else
The two dimensions are not equal
\fi
\bye
Outputs:

One needs 17 fractional digits to be certain that the dimension stabilizes (of course you get only 1sp possible difference after 5 fractional digits, because 1/10^5 < 1/65536
, here in this example where one multiplies 1pt
). And some things are counterintuitive, for example 0.33333
is enough but 0.22222
is not although it looks closer to 0.222222
than 0.33333
was to 0.333333
.
It goes without saying that Knuth has programmed it exactly to fetch 17 fractional digits and not one more, because the theorem is that it will never change after that.
As another random example consider this
\number\dimexpr 0.824440000pt\relax
\number\dimexpr 0.824440003pt\relax
\bye
which produces

showing that 0.824440003
gives distinct result from 0.82444
.
We can confirm this also in a rôle as <factor>
:
\documentclass[a4paper]{article}
\usepackage{geometry}
\newlength{\mylength}
\begin{document}
\setlength{\mylength}{0.82444\linewidth}
\verb|0.82444\linewidth| gives \the\mylength.
\setlength{\mylength}{0.824440003\linewidth}
\verb|0.824440003\linewidth| gives \the\mylength.
These two things differ!
I hope this will dispel some misunderstandings\\
about ``five fractional digits suffice''. Wrong.
\end{document}

Notice that above \linewidth
is 418.25368pt
so 0.000000003\linewidth
is in truth 0.00000125476104pt
well below the TeX "error".
THE DIFFERENCE IS AMPLIFIED BY A FACTOR GREATER THAN 5000 !
As per the actual question, here is my comment
the most precise way to multiply by a fraction is \dimexpr\numexpr A*<dimen>/B sp\relax (where <dimen> is like \linewidth but not 10pt then use \dimexpr10pt\relax in place of <dimen>)
\dimexpr\linewidth/3
and\dimexpr7\linewidth/8
work. However TeX uses scaled integers to represent dimensions, so technically0.3333333333333\linewidth
is more precise than TeX's representation of\linewidth/3
. When you input a long decimal chain like that TeX will truncate that to a value it can represent.\dimexpr\numexpr A*<dimen>/B sp\relax
(where<dimen>
is like\linewidth
but not10pt
then use\dimexpr10pt\relax
in place of<dimen>
)