Number Systems in Computers |
||
|
|
Storing Stuff in Computers |
|||||||||||||
|
Most people know that everything in computers is stored using numbers, and that the basic numbers the computer stores are zero and one. But why do computers stick to 0 and 1, and how can they use only those two numbers to do so much? That's the topic of this module. |
|||||||||||||
Why Base Two? |
The number system in computers is base two, or binary. This is because of mathematician John V. Atanasoff's decision in 1938 to try building an all-electronic computing device using the simplest numbering system available. Base two has only two digits: 0 and 1. In everyday life, we use the base 10 decimal number system. But Atanasoff tried using that to build a computer, and it was much too complicated. The numbers 0 and 1 can easily be represented in many devices, and from Atanasoff's successful experiment using vacuum tubes has come our entire world of digital electronics. |
||||||||||||
Bits |
The utility of binary numbers is that they can be represented in very simple ways.
No matter how it's done physically, these two- state (on/off) devices can represent a single binary digit: zero or one. A binary digit is called a bit. You can think of a bit like a little light: either on or off.
|
||||||||||||
Grouping Bits |
One bit by itself has only limited value. But when several of them are grouped together, they're pretty powerful. Since the system is based on two states, it makes sense to join bits together in multiples of two: 4, 8, 16, 32, 64, etc. Here's what those multiples are called:
Of these, the most important and familiar is byte. A byte is 8 bits Bytes are especially useful because: One byte holds one character
|
||||||||||||
Numbering Systems |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
When you use computers a lot, you're likely to run into three ways of representing numbers: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Representing Binary Numbers |
Binary numbers are simple, but they are clumsy for people to use because, to represent numbers greater than 1, more digits have to be used. Here are a few examples, just to give you the picture:
You can see that it is very easy to take up a lot of space and get confused! Computers and humans do best when binary numbers are divided into chunks. The most logical chunks for binary numbers is in powers of two, such as 2, 4, 8, 16, 32... We could make the larger numbers above a little easier to understand by "chunking" into groups of 4, like this:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Why Hexadecimal? |
That's better, but even more bulky. How to compress the notation, and still maintain the groupings of binary digits that are fundamental to the "nybbles" (4 bits) and "bytes" (8 bits) of computer memory and disk storage? And why do many computer applications use hexadecimal numbering? The answer lies in using a number base that is a power of 2 (2, 4, 8, 16, 32). In the 1960s and 1970s, octal (base 8) notation was commonly used. Base 16 is more convenient though, because of the universal division of computer memory into bytes of 8 bits each: two base-sixteen digits exactly represent one byte of memory. There's only one problem: we don't have 16 digits available! After 9, we run out. The solution is to take the letters of the alphabet and press them into service above the number 9. The next section shows how this works... |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Binary-Decimal-Hex |
Here is a chart of the first 16 numbers in three number bases:
Hexadecimal notation is clearly the most compact of the three ways to represent numbers. Here are those larger numbers:
To explore hexadecimal numbering, see Hypersolutions Thinking Hexadecimally, at http://www.hypersolutions.org/pages/hex.html. This includes a built-in converter from decimal to hex and back again.
The program usually looks like a simple calculator, but under the View menu you can change it to look like a scientific calculator. In this view, you can convert numbers to and from Hexadecimal, Decimal, Octal, and Binary, by clicking on a radio-button below the display window (shown in the accompanying figure).
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
About this document... |
|
|---|---|
Audience: |
This is for people who want to understand the basics of number storage and representation in computers. No previous knowledge is required. |
Objectives: |
When you successfully complete this lesson, you will be able to...
|
Module g17c: |
This document is part of a modular instruction series in Computer Information Systems. For more information, see the overview or the list of modules in this series, W: World Wide Web.This document has been used in the following classes: CIS 100 |
Author: |
Laurence J. Krieg |
Institution: |
|
| History: | Original: 20 February 2006; parts derived from module W22e. Last modification: Tuesday, 21-Feb-2006 08:42:51 EST |
| Copyright: | Copyright
© 2006, Laurence J. Krieg, Washtenaw Community College. Instructors: You may point to this file in your Web-based materials. Students: you may make a copy for your personal use. All other uses: contact the author, Laurence J. Krieg for permission. Email krieg@ieee.org |