home | 163 . 202 . 244 . 253 . 355 | courses | advisees | faq | honesty | jupiter files | schedule | webpage help | unix help | c++ help | vb help | assembly help

   powers of 2

We use digits on a daily basis to quantify and control the things in our lives. We live in a DECIMAL world - base 10 - with digits 0-9.

For example: To make license plates that only have 3 DECIMAL (0-9) digits, we could make 1000 unique plates (000-999) which is 10^3.

With computers, we typically put digits together for a wide array of uses, but the computer uses BINARY digits (0-1).

For example, representing colors: How many colors could we represent with 3 BINARY digits? We could represent 8 colors (000-111) which is 2^3.

It is good to develop an intuitive sense of the ranges associated with n bits.


n 2^n Range: unsigned Range: signed (2's comp.) Name
1 bit 2 0 .. 1 1 bit
2 bits 4 0 .. 3 -2 .. 1 2 bits
4 bits 16 0 .. 15 -8 .. 7 nibble
8 bits 256 0 .. 255 -128 .. 127 byte
16 bits 65,000+ (64k) 0 .. 65,535 -32,768 .. 32,767 word
32 bits 4 billion+ 0 .. 4,294,967,295 -2,147,483,648 .. 2,147,483,647 longword
64 bits 0 .. 18,446,744,073,709,551,615 -9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807 quadword

How many colors can be represented with 4 bits? 8? 16? 24? 32? Tradeoffs when representing images?
How many bytes of memory can be addressed with 4 bits? 8 ? 16? 20? 30? 32? 64? Addresses are how long in most machines? Each address is the address of a what?

Valid XHTML 1.0 Transitional