performance problem in python 2.2

Gerhard Häring gerhard.haering at gmx.de
Fri Jul 26 21:40:20 EDT 2002


* Paul Rubin <phr-n2002b at NOSPAMnightsong.com> [2002-07-26 18:13 -0700]:
> 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,

It is. C99.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9  3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))




More information about the Python-list mailing list