Re: newbie: precision question

2009-03-21 Thread MRAB
Lada Kugis wrote: [snip] 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

Re: newbie: precision question

2009-03-20 Thread alex goretoy
I think you are looking for this: (math.pi - (math.sqrt(math.pi)))**2 1.8745410610157363 simple, multiplication and division have a higher precedence over addition and subtraction -Alex Goretoy http://www.goretoy.com -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: precision question

2009-03-20 Thread Paul Watson
On Sat, 2009-03-21 at 04:12 +0100, Lada Kugis wrote: I'm a newbie learning python, so forgive for, what may seem to some, like a stupid question. I understand the basic integer and fp type, but what I'm having a little trouble are the long type and infinite precision type. Also, when I do

Re: newbie: precision question

2009-03-20 Thread Steven D'Aprano
On Sat, 21 Mar 2009 04:12:48 +0100, Lada Kugis wrote: I'm a newbie learning python, so forgive for, what may seem to some, like a stupid question. I understand the basic integer and fp type, but what I'm having a little trouble are the long type and infinite precision type. Also, when I

Re: newbie: precision question

2009-03-20 Thread Steve Holden
Lada Kugis wrote: I'm a newbie learning python, so forgive for, what may seem to some, like a stupid question. I understand the basic integer and fp type, but what I'm having a little trouble are the long type and infinite precision type. Longs are essentially unbounded integers. You can

Re: newbie: precision question

2009-03-20 Thread AggieDan04
On Mar 20, 10:12 pm, Lada Kugis lada.kugis@@gmail.com wrote: I'm a newbie learning python, so forgive for, what may seem to some, like a stupid question. I understand the basic integer and fp type, but what I'm having a little trouble are the long type An int is limited to 32 or 64 bits. A

Re: newbie: precision question

2009-03-20 Thread Lada Kugis
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

Re: newbie: precision question

2009-03-20 Thread Mensanator
On Mar 20, 11:02�pm, Lada Kugis lada.ku...@gmail.com wrote: 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