The Wikipedia page on repeating decimals is relevant to this discussion. I will use "bracket notation" as defined on that page. First, let's explain bracket notation:

One third = 1 / 3 = 0.3333... = 0.(3)

One eleventh = 1 / 11 = 0.090909... = 0.(09)

As you can see, the sequence of digits inside parentheses is repeated forever.

To denote numbers in different bases, I will use Python notation. Thus "1234" is in base 10, "0x12ab" is in base 16, "0o1234" is in base 8, and "0b101101" is in base 2. You can use these prefixes (0x, 0o, and 0b) in Python code, did you know that?

Now on to the results:

1 / 10 = 0.1 = 0b0.0(0011) = 0b0.000110011001100110011...

1 / 100 = 0.01 = 0b0.00(00001010001111010111) =
= 0b0.00000010100011110101110000101...

As you can see, one hundredth has a period of 20 digits in base 2. There is a block of 20 digits that is repeated forever.

Here is a great fraction:

1 / 81 = 0.(0123456789) = 0.01234567890123456789...

Why is 1 / 81 so fantastic? Well, we are in base 10. Base 9 is one off. 9 squared is 81. That is why 1 / 81 is so fantastic. Base 10 and base 9 have a very special relationship, look up "casting out nines" for more mind-blowing but simple math.

Zak Fallows

On 4/14/13 7:30 PM, Algis Kabaila wrote:

Just to add a little fuel to this fire:

 

First, by hand try to convert the "exact" 0.1 then 0.01 decimal to their binary equivalent. Send to this list the binary value. Is it exact?

 

Second, who would care about 1 cent in $10 000 ?

 

Al.


_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside

Reply via email to