# Number Bases

(Difference between revisions)
 Revision as of 22:55, 30 March 2009 (view source)Wtd (Talk | contribs)← Older edit Revision as of 23:08, 30 March 2009 (view source)Wtd (Talk | contribs) Newer edit → Line 55: Line 55: Now we should be able to extrapolate this pattern out to deal with decimal numbers of any length. Now we should be able to extrapolate this pattern out to deal with decimal numbers of any length. + + === Binary === + + Binary is a very formal way of saying "base 2."  In base 2 the only digits at our disposal for representations are 0 and 1.  Let's break down a binary number. + + {| style="text-align: center" border="1" cellpadding="5" cellspacing="0" + |- + ! colspan="8" | Breakdown of 11001101 + |- + | 1 x 128 || 1 x 64 || 0 x 32 || 0 x 16 || 1 x 8 || 1 x 4 || 0 x 2 || 1 x 1 + |- + | 1 x 27 || 1 x 26 || 0 x 25 || 0 x 24 || 1 x 23 || 1 x 22 || 0 x 21 || 1 x 20 + |- + | 1 x b7 || 1 x b6 || 0 x b5 || 0 x b4 || 1 x b3 || 1 x b2 || 0 x b1 || 1 x b0 + |- + |+ ''where b = 2'' + ! colspan="8" | Equivalent Decimal Representation + |- + | 128 || 64 || 0 || 0 || 8 || 4 || 0 || 1 + |} + + When we add the decimal equivalents together using the addition we all know quite well, we get 205.

## Number Bases

In math and computer science, numbers are often taken for granted, but understanding them is absolutely essential. The first thing to understand about numbers is how they're written, and for that we have to understand number bases.

### Decimal

The base we're all raised on these days is base 10. We all know that in decimal representation "1" is one, "2" is two" and "456" is four hundred and fifty-six, but how does this actually work? How do we know that that "4" being where it indicate four hundred and how does the 5 being where it is indicate fifty?

In the case opf 456, we can see this as follows.

456 broken down
4 x 100 5 x 10 6 x 1

Of course, if you know anything about exponents, you should notice that there's a very simple pattern here.

456 broken down further
4 x 100 5 x 10 6 x 1
4 x 102 5 x 101 6 x 100

We can factor this out further

Factoring out the base
4 x 100 5 x 10 6 x 1
4 x 102 5 x 101 6 x 100
4 x b2 5 x b1 6 x b0
where b = 10

Now we should be able to extrapolate this pattern out to deal with decimal numbers of any length.

### Binary

Binary is a very formal way of saying "base 2." In base 2 the only digits at our disposal for representations are 0 and 1. Let's break down a binary number.

Breakdown of 11001101
1 x 128 1 x 64 0 x 32 0 x 16 1 x 8 1 x 4 0 x 2 1 x 1
1 x 27 1 x 26 0 x 25 0 x 24 1 x 23 1 x 22 0 x 21 1 x 20
1 x b7 1 x b6 0 x b5 0 x b4 1 x b3 1 x b2 0 x b1 1 x b0
where b = 2
Equivalent Decimal Representation
128 64 0 0 8 4 0 1

When we add the decimal equivalents together using the addition we all know quite well, we get 205.