How to calculate an n digit decimal approximation of a fraction? Say I have a number x

watch5826c

watch5826c

Answered question

2022-06-13

How to calculate an n digit decimal approximation of a fraction?
Say I have a number x Q which possibly cannot be writen exactly in decimal form, but at least x 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 = 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.

Answer & Explanation

upornompe

upornompe

Beginner2022-06-14Added 20 answers

A simple algorithm is the following :
Take integer part multiply the numerator of the remainder by 10 (in base 10) divide by the denominator repeat
Each integer part obtained is one digit.
Once you decide you have enough digits, use common sense to place the dot.
Example :
For 1000 1001
The integer part is 0 so the first digit is 0
The remainder is 1000 1001
We multiply the numerator by 10 : 1000 × 10 = 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 × 1001 = 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.)
Winigefx

Winigefx

Beginner2022-06-15Added 4 answers

To find if it has a terminating decimal, so has a finite number of nonzero digits, check if the denominator factors as 2 a 5 b . If the denominator has any prime factors other than 2 or 5, the decimal will repeat infinitely. The termination will come at max ( a , b ) because the denominator will divide evenly into 10 max ( a , b )

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?