Long Shifty Bits

Nathaniel Gray n8gray at caltech.edu.is.my.e-mail.address
Thu Mar 8 01:00:33 EST 2001


Phlip wrote:

> Michael Hudson wrote:
> 
>> Works for me.  Have you tried it?
> 
>>>> x = 1L << 200
>>>> x
> 1606938044258990275541962092341162602522202993782792835301376L
> 
> Ouch. Just trying it did not occur to me. The expression's deep inside a
> blob of logic, and I just assumed when I hit a bug up around 32 elements
> that I had misrepresented <<'s prowess.
> 

Just make sure your variable is *definitely* a long and not just an int!

[n8gray at golux n8gray]$ python
Python 1.5.2 (#1, Dec 21 2000, 15:29:08)  [GCC egcs-2.91.66 19990314/Linux 
(egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> 1 << 200
0

-n8

-- 
_.~'^`~._.~'^`~._.~'^`~._.~'^`~._.~'^`~._
             Nathaniel Gray
   California Institute of Technology
     Computation and Neural Systems
     n8gray <at> caltech <dot> edu
_.~'^`~._.~'^`~._.~'^`~._.~'^`~._.~'^`~._




More information about the Python-list mailing list