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:

but some cannot, like:

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?

Thank you in advance.

Re: Endless decimal representations

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, . 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 ). 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.

Re: Endless decimal representations

That is absolutely fascinating.