"Thomas Bartkus" <[EMAIL PROTECTED]> wrote: > "Grant Edwards" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> On 2006-05-08, Thomas Bartkus <[EMAIL PROTECTED]> wrote: >> >> >> does python support true rations, which means that 1/3 is a >> >> true one-third and not 0.333333333 rounded off at some >> >> arbitrary precision? >> > >> > At risk of being boring ;-) >> > >> > - Python supports both rational and irrational numbers as >> > floating point numbers the way any language on any digital >> > computer does - imprecisely. >> > >> > A "true" (1/3) can only be expressed as a fraction. >> >> At the risk of being both boring and overly pedantic, that's >> not true. In base 3, the value in question is precisely >> representable in floating point: 0.1 >> >> > As soon as you express it as a floating point - you are in a >> > bit of trouble because that's impossible. >> >> It's not possible in base 2 or base 10. It's perfectly >> possible in base 9 (used by the Nenets of Northern Russia) base >> 12 (popular on planets where everybody has twelve toes) or base >> 60 (used by th Sumerians). [I don't know if any of those >> peoples used floating point in those bases -- I'm just pointing >> out that your prejudice towards base 10 notation is showing.] >> >> > You can not express (1/3) as a floating point in Python any >> > more than you can do it with pencil and paper. >> >> That's true assuming base 2 in Python and base 10 on paper. The >> base used by Python is pretty much etched in stone (silicon, to >> be precise). There used to be articles about people working on >> base-3 logic gates, but base-3 logic never made it out of the >> lab. However, you can pick any base you want when using paper >> and pencil. >> >> > You can be precise and write "1/3" or you can surrender to >> > arithmetic convenience and settle for the imprecise by writing >> > "0.333333333", chopping it off at some arbitrary precision. >> >> Or you can write 0.1 >> 3 >> >> :) > > Ahhh! > But if I need to store the value 1/10 (decimal!), what kind of a precision > pickle will I then find myself while working in base 3 ? How much better > for precision if we just learn our fractions and stick to storing integer > numerators alongside integer denominators in big 128 bit double registers ? > > Even the Nenets might become more computationally precise by such means ;-) > And how does a human culture come to decide on base 9 arithmetic anyway?
Just guessing: * Use one thumb to point at one of the other 9 fingers * Every finger (except for the thumb) has 3 segments (and links), each of which can easily divided in three part (upper, middle, lower or left middle, right for the links) making 9 points for each finger. > Even base 60 makes more sense if you like it when a lot of divisions come > out nice and even. You can count to 60 using two hands: Use the right thumb to point on one of the 12 segments of the remaining 4 fingers and on the left hand one finger for each dozen. Of course this is wasting resources as you can count to 1023 with your fingers. I never heard of a culture doing so, though. Florian -- <http://www.florian-diesch.de/> -- http://mail.python.org/mailman/listinfo/python-list