lpetrich
Contributor
A feature of rational numbers is that their decimal representations always have infinitely repeating sequences of digits. This is true not only for base 10, but also for every possible base of a place system.
Examples:
1 = 1.000000... = 0.999999...
1/3 = 0.333333...
1/6 = 0.166666...
1/7 = 0.142857142857142857...
1/9 = 0.111111...
In base 2:
1/3 (11) = 0.01010101...
1/5 (101) = 0.001100110011...
In base 3:
1/2 = 0.11111111...
That is why decimal representations are usually not exactly translated into floating-point binary representations. One only has a finite number of digits available, and one has to cut off an infinite sequence of them.
It is easy to prove that an infinite repeating sequence of digits gives a rational number.
It is more difficult to prove that every rational number can be represented with an infinite repeating sequence of digits, but it can be done.
Examples:
1 = 1.000000... = 0.999999...
1/3 = 0.333333...
1/6 = 0.166666...
1/7 = 0.142857142857142857...
1/9 = 0.111111...
In base 2:
1/3 (11) = 0.01010101...
1/5 (101) = 0.001100110011...
In base 3:
1/2 = 0.11111111...
That is why decimal representations are usually not exactly translated into floating-point binary representations. One only has a finite number of digits available, and one has to cut off an infinite sequence of them.
It is easy to prove that an infinite repeating sequence of digits gives a rational number.
It is more difficult to prove that every rational number can be represented with an infinite repeating sequence of digits, but it can be done.