How this calculator works
A fraction produces a terminating decimal exactly when its reduced denominator has no prime factors other than 2 and 5. The reason is that the decimal is built by dividing into tenths, hundredths and so on, and a denominator of 2^a × 5^b divides a power of ten. Reduce first, because a common factor can hide a denominator that would otherwise seem to fail the test: 6/15 reduces to 2/5 and therefore terminates.
Formula
Write the reduced denominator as 2^a × 5^b × m. The decimal terminates when m = 1, with exactly max(a, b) decimal places. Otherwise it repeats with a period dividing the order of 10 modulo m.
Worked example
3/8 has the reduced denominator 8 = 2³, so it terminates after three places: 0.375. The fraction 1/3 has denominator 3, so it repeats: 0.333... The fraction 7/12 has denominator 12 = 2² × 3, so it repeats as 0.58333...
Advertisement
Frequently asked questions
Why do some fractions repeat?
If the reduced denominator has a prime factor other than 2 or 5, no power of ten is divisible by it, so the division never comes out even. The remainders must eventually repeat because there are only finitely many possible remainders, and the decimal repeats from that point.
Does the numerator matter?
Only through the common factor it shares with the denominator. Reduce first; after that the denominator alone decides whether the decimal terminates.
How long can the repeating part be?
The period divides the order of 10 modulo the leftover prime factors, so for a prime p other than 2 and 5 the period is at most p - 1. The largest periods are often close to that bound.
Is every terminating decimal a fraction?
Yes. A decimal with a fixed number of places is a fraction with a power of ten in the denominator, such as 0.375 = 375/1000 = 3/8. Terminating and repeating decimals are exactly the rational numbers.