[SciPy-user] Naive Question about Data Representations
David Warde-Farley
dwf at cs.toronto.edu
Fri Jun 20 23:10:39 EDT 2008
On 20-Jun-08, at 9:48 PM, Brian Lewis wrote:
> Sorry for my naivety.
>
> Can someone explain how it is possible to store more than 1 32-bit
> integer on a 32-bit system? I hope this questions makes my
> confusion obvious.
If by "32-bit system" you mean "32-bit processor/operating system",
this refers to the number of bits in a memory address, and by
extension that the system can deal with 2^32 distinct memory
addresses / locations (4 GB on a 32-bit system, though you can't
usually use a full 4GB of physical memory since lots of addresses are
reserved for use by the system for things like I/O devices).
A 32-bit integer will occupy 4 bytes of system memory (8 bits per
byte), and any valid memory address will have to be such a 32-bit
integer, but you could store much, much bigger numbers by just
occupying more bytes of memory. For example, the long long type in C
occupies 8 bytes = 64 bits.
While any given programming language may not support it directly, you
could store an integer as big as your system's memory would allow, for
example you could allocate 4 megabytes and use it to store a 33554432
bit number if you wanted, or 2 gigabytes and store a 17179869184-bit
number. Working with it in your programs wouldn't be pleasant, but it
would be possible.
David
More information about the SciPy-User
mailing list