performance problem in python 2.2

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Fri Jul 26 21:13:45 EDT 2002


Jeff Davis <jdavis at empires.org> writes:

> If you read my C code, you'll see that I used the 'unsigned long long type' 
> which is a 64-bit int. And I only stored 2^32 in it. When I needed to 
> crunch the numbers, I treated 2^64 as p*p (because 2^64 == 
> sqrt(2^64)*sqrt(2^64) == 2^32*2^32), and then I commuted the 
> multiplication so it would happen in a way that wouldn't overflow. 

Oh whoops, yes, I missed that.  "Long long" is not part of standard C,
though some compilers support it.  



More information about the Python-list mailing list