On 21 Mar 2009 03:34:18 GMT, Steven D'Aprano <st...@remove-this-cybersource.com.au> wrote:
Hello Steven, thanks for answering on such short notice, > >Floats in Python don't have infinite precision. > >Ints (or longs) can have infinite precision. Try calculating (say) >1234567**315*24689 and you should get 1923 digits. By the way, you can do >calculations on ints with tens of thousands of digits *much* faster than >you can print those same ints: on my computer, calculating all 75199 >digits of 1234567**12345 takes less than an eye-blink, while printing it >takes ages. Yes, I've tried things like >>> print 2**10000 (gives a large, really mind-boggingly huge big number :) So, if I understood you right, integers can have infinite precision and floating points are up to 16 digits (if I remember anything they thought me in my C classes) because they cannot be represented exactly in binary form. C representation, can of course vary according to platform, compiler etc. Normal integers are up to 10 digits, after which they become long integers, right ? But if integers can be exactly represented, then why do they need two types of integers (long and ... uhmm, let's say, normal). I mean, their error will always be zero, no matter what kind they're of. Lada > >Floats, on the other hand, are effectively the same as double on the C >compiler for your platform. > >Does this answer your question? -- http://mail.python.org/mailman/listinfo/python-list