Long Shifty Bits

Nathan Gray n8gray at caltech.edu.is.my.e-mail.address
Tue Mar 6 18:22:28 EST 2001


Phlip wrote:

> Not hyp:
> 
> I want this expression to make sense:
> 
>         x = 1L << 200
> 
> If someone tells me "it will roll over at the 32nd bit", or mayby even "it 
> will roll over when the CPU damn well feels like it", that's okay. I'l just 
> construct a Bit Vector of some ilk and drop my bits into it. But the above 
> notation is closest to our problem space, so it would be nice if it worked 
> as expected.

[n8gray at term92 controllers]$ python
Python 1.5.2 (#1, Feb  1 2000, 16:32:16)  [GCC egcs-2.91.66 
19990314/Linux (egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
 >>> x = 1L << 200
 >>> x
1606938044258990275541962092341162602522202993782792835301376L
 >>> x >> 200
1L


-n8

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




More information about the Python-list mailing list