I can calculate the number of digits in $x$:
$$M=\Big\lfloor\log_{10}{x}\Big\rfloor+1$$
And then calculate the first $N$ digits in $x$:
$$\Big\lfloor\frac{x}{10^{M-N}}\Big\rfloor$$
Is there any trick to achieve that without counting the number of digits in $x$ to begin with?
int,unsigned int,uint256, etc, would be a good analogy. – bbbbbbbbb Feb 17 '23 at 14:54