001100001001 = 309 = 777?

Base ??

What is a number system? I imagine, for the beginner, that's what you're thinking, but you use a number system every day (I hope!).

A number system, to put it simply, is a mehodology for counting. The number system you use for calcuating general, every day arithmatic, is base 10.

There are three main number systems you need to understand to get it with computers. They are: base 10, base 2, and base 16. For the uninitiated, this may sound like black magic, but it's not.

Base 10

We all know base 10, but to make it clear, it is the system of counting to 9. First there is the ones place, then the tens place, hundreds place, etc. Each place value after the ones place is a multiple of 10.

Once the ones place exceeds 9, the tens place increments one, and the ones place decrements to 0. This algorithm repeats for each place value. To drive the point home, lets go through two more examples:

19: The tens place is 1 and the ones place is 9. If we add 1, this will increment the tens place by 1, and decrement the ones place to 0; 20.

99: The tens place is 9, and the ones place is 9. If we add 1, this will increment the next place value, the hundreds place, and decrement the tens and ones place to 0; 100.

Base 2 - Binary

Base 2, or binary, works exaclty the same as base 10, but instead of counting to 9, we count to 1. Whaaaaaat?? Count to 1? How do you get to 10?

I get it. If this is a new concept, it's a real mind bender, but the bottom line is, there are different ways to count. I think the easiest way to think about it is- rather than each place value being a multiple of 10, each place value is a multiple of 2.

Instead of a ones place, tens place, hundreds place, etc, we have a ones place, twos place, fours place, eights place, etc.

What does this look like?

Lets count to 10, but in binary.

  • base 2
  • 0000
  • 0001
  • 0010
  • 0011
  • 0100
  • 0101
  • 0110
  • 0111
  • 1000
  • 1001
  • 1010
  • base 10
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

Note: the leading 0's under base 2 are not necessary, but it's common to see binary written this way. We will learn more about this when we explore Data Types.

0011 (Base10: 3) The twos place is 1, and the ones place is 1. If we add 1, this will increment the fours place by 1, and decrement the twos and ones place to 0; 0100 (Base10 4)

Base 16 - Hexadecimal

Base 16, or hexadecimal, throws another wrench into things. Although hexadecimal works exactly the same as base 10 and binary. An untrained mind might think, "okay, I get it. Instead of counting to 9, we count to 15," but this is only kind of true.

Hexadecimal, or hex for short, counts to F...

hear me out, I promise it makes sense. If we think about what we've learned about number systems, we can't just count to 15. Note, 15 is a base 10 number; 15 is 1 tens place and 5 ones place, so what we do is represent the numbers after 9 with letters.

Nonetheless, hexadecimal works the same as the other two number systems. Except now we have the ones place, sixteeens place, two hundred fifty six place, etc. Each place value is a multiple of 16.

What does this look like?

Let's count to 15 in hexadecimal.

  • Base 16
  • 0x00
  • 0x01
  • 0x02
  • 0x03
  • 0x04
  • 0x05
  • 0x06
  • 0x07
  • 0x08
  • 0x09
  • 0x0A
  • 0x0B
  • 0x0C
  • 0x0D
  • 0x0E
  • 0x0F
  • Base 2
  • 0000
  • 0001
  • 0010
  • 0011
  • 0100
  • 0101
  • 0110
  • 0111
  • 1000
  • 1001
  • 1010
  • 1011
  • 1100
  • 1101
  • 1110
  • 1111
  • Base 10
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

Note: hexadecimal is typically prefixed with 0x

0xAF (Base10: 175) The thirty-two's place is A, and the ones's place is F. If we add 1, this will increment the sixteens's place by one and decrement the ones's place to 0; 0xB0 (Base10: 176)

0x1A (Base10: 26) The sixteen's place is 1, and the one's place is A. If we subtract by 1, this will decrement the one's place by 1; 0x19 (Base10: 25)

Conclusion

To sum up, there are different number systems. It may seem odd if you've never thought about it, and you may be wondering why any of this is important. All will be answered, please have patience. We have to start somewhere, and understanding these topics will make it easier for me to explain things like bits, bytes, etc later. Which in turn will make it easier for me to explain even more complex things down the line.

In Base 10 we count to 9.

In Binary we count to 1, and it's not uncommon to see leading 0's.

In Hexadecimal we count to F, and generally prefix with 0x.

Each number system follows the same algorithm for counting. Once a place value reaches it's maximum value, the next place value is incremented and the previous place values are decremented to 0.

I hope this makes sense. Most books spend several pages to discuss this topic, but I've tried to condense it down into a few minute read. We didn't get into performing arithmetic, but I think this should suffice for better understanding the following sections.

< Last

.:Number Systems:.

Next >
Anon: "Spaghetti? Again?"