1. ## Endless decimal representations

Hi.
I'm studing floating point representation of binary numbers, and it made me notice something.
Well, actually, I noticed it before of course, but it never occurred to me to ask about it up until now:

There are some numbers, rational numbers, that can be presented in a finite decimal floating-point representation,
for example:
$\displaystyle \frac{1}{2}=0.5$

$\displaystyle \frac{3}{4}=0.75$

but some cannot, like:
$\displaystyle \frac{1}{3}=0.33333...$

$\displaystyle \frac{5}{7}=0.714285714285...$

My question is why?
what distinguish "infinite decimal floating-point representation" from the ones that can be written in a finite form?

I also noticed (and correct me if I'm wrong) that when it comes to binary floating-point representation, the "problem" is much bigger:
There are considerably much more fractions that cannot be represented in a finite series of digits, then the ones that can.
Why does that happen?

Are you familiar with prime factorization of integers? Any integer can be expressed as a finite product of primes. Using exponents, a rational number can be expressed as a product of a finite number of prime powers (where the exponent of each prime is an integer). For example, $\displaystyle \dfrac{1,185,921}{18,974,736,000} = \dfrac{3^4\cdot 11^4}{2^7\cdot 3^4\cdot 5^3\cdot 11^4} = 2^{-7}\cdot 3^0 \cdot 5^{-3}\cdot 11^0$. When representing a fraction with decimals, if the only primes with negative exponents are for 2 and 5, the decimal expression will be finite (this is because $\displaystyle 10 = 2\cdot 5$). If any other prime has a negative exponent, it will be an infinite representation. In binary, if the only prime with a negative exponent is 2, then it will have a finite binary representation. Otherwise, it will be infinite.