[Tutor] << operator ? [left bitwise shifting / Jon Bentley's
Programming Pearls]
Danny Yoo
dyoo@hkn.eecs.berkeley.edu
Sun, 14 Apr 2002 00:44:28 -0700 (PDT)
> > And this is what we mean when we say that computers count in base-two
> > arithmetic --- they represent numbers by using on/off switches --- "bits".
> > On most systems that Python runs on, each integer is made up of 32 bits.
>
> Hmm .. is this the difference between the computers used popularly
> today, and the new IA-64 architecture ? If so, does a "2" on a 64-bit
> machine have 32 more zeroes in front of it, than a "2" on a 32-bit
> machine ?
Yes, I believe so. On a 64 bit machine, integers should be represented in
64 bits.
> Ok. I think I've got a hang of what these operators do. Now to go find a
> binary file to play with in "pure" python .... :-)
If you ever get the chance, youy might be interested in the book
"Programming Pearls", by Jon Bentley. If you browse through Column 1,
you'll see a great example of bits in action. *grin*
http://www.cs.bell-labs.com/cm/cs/pearls/cto.html
Best of wishes to you!