Say I have a number $x \in \mathbb{Q}$ which possibly cannot be writen exactly in decimal form, but at least $x \notin \mathbb{Z}$ ($x$ is not an integer).
How do I calculate the first $n$ digits of this number $x$, for a given $n$? Also, how do I know if it has a finite or infinite amount of (nonzero) digits in decimal form?
For example, if $x = \frac{1000}{1001}$, how do I calculate the first $n = 10$ digits of this number?
I know this question sounds really basic, but since it is basically always done by means of a calculator or other computing device, I've never really done it before.
A simple algorithm is the following :
Take integer part $\rightarrow$ multiply the numerator of the remainder by $10$ (in base $10$) $\rightarrow$ divide by the denominator $\rightarrow$ repeat
Each integer part obtained is one digit.
Once you decide you have enough digits, use common sense to place the dot.
Example :
For $\frac{1000}{1001}$
The integer part is $0$ so the first digit is $0$
The remainder is $\frac{1000}{1001}$
We multiply the numerator by $10$ : $1000\times10=10000$
We divide by the denominator $1001$ and take the integer part : $9$
So the second digit is $9$.
The numerator of the remainder is $10000-9\times1001=991$
Multiply it by $10$ and get $9910$
Divide by $1001$, take the integer part : $9$, which is our third digit...
etc.
So the first three digits are $0.99$
I let you compute the other ones !
(It is basically long division, but it was so badly taught to me I didn't even understand I could just work that way without drawings or fluff, and it seems much easier now, especially for mental maths.)