Numeric Limitations of Computers

Computers cannot represent infinite mathematical sets like the integers or real numbers we learned about in grade school math. Each digit in a number requires memory in which to store it. An infinitely large number has an infinite number of digits, and no computer has infinite memory for storing all these digits. Many finite numbers, such as PI, also have an infinite number of digits, so they cannot be represented precisely in computer hardware.

CPUs process information using a limited set of simple operations known as machine instructions. A single machine instruction might add two integers or copy data from one place to another. In addition to the limits on memory, computer CPUs have much smaller limits on how much data they can process at once (with a single machine instruction). This limit is known as the CPU's word size. At the time of this writing, most computers can process at most 64 bits at once, which corresponds to an integer value of no more than 264-1, or 1.84467440737e+19. (More on this later.) Older computers can only process 32 bits (an integer of 232-1, or 4,294,967,295). Still older computers and many modern micro-controllers are limited to 16 bits (an integer of 65,535).

It is possible for a CPU to process values larger than its word size. It simply can't do it all at once (in a single machine instruction). A 32-bit computer can add 64-bit numbers, but it has to do it 32-bits at a time, and hence it takes twice as long. This is known as multiple precision arithmetic. Multiple precision addition and subtraction are straightforward. Multiple precision multiplication and division are much more complex, so multiplying 64-bit numbers on a 32-bit computer will take more than two instructions.

Software exists for processing arbitrarily large (arbitrary precision) values, with any number of significant figures, regardless of the word size of the hardware. The bc calculator, which is a standard part of every Unix system, is an example. Just be aware that processing arbitrary precision numbers takes an arbitrarily long time and requires an arbitrary amount of memory.

Another limit imposed by a CPU's word size is how much memory it can address. Computer memory is essentially an array of values and the address is a subscript of limited size. The size of a memory address in most CPUs is the same as its word size. Hence, most 32-bit CPUs use a 32-bit memory address and can address no more than 232 bytes (4 gibibytes) of RAM. Many computers today use much more than this. A 64-bit CPU can theoretically address up to 264 bytes (16 exbibytes), which is far more than today's computers can have installed. In fact, this would require over a billion 16 gibibyte memory chips. A typical PC has 4 or 8 memory slots.



Be sure to thoroughly review the instructions in Section 2, “Practice Problem Instructions” before doing the practice problems below.
  1. What is the main difference between mathematical sets such as integers and real numbers, and computer number systems?

  2. What is a computer's word size?

  3. Can computers process numbers larger than their word size?

  4. Describe two advantages of a 64-bit computer over a 32-bit computer.