Binary

While we normally use decimal counting systems, computers use binary. We tend to assume that there is only decimal until we start to explore computers a little further. But there are other counting systems in use today and others have been used in the past.

Base Values

The base value of a number system is the number of different values the set has before repeating itself. For example, decimal has a base of ten values, 0 to 9. The more important systems are in bold.

  • Binary = 2 (0, 1)
  • Octal = 8 (0 - 7)
  • Decimal = 10 (0 - 9)
  • Duodecimal = 12 (used for some purposes by the Romans)
  • Hexadecimal = 16 (0 - 9, A-F)
  • Vigesimal = 20 (used by the Mayans)
  • Sexagesimal = 60 (used by the Babylonians)

Bits and Bytes

A single binary digit is called a bit. It can have a value of either 0 or 1. In other words, two possible values. This is similar to decimal which uses the digits 0-9 (10 possible values).

Since one binary digit (a bit) is not much use by itself, we tend to use bits in groups of 8, called bytes. Each bit in a group of 8 bytes is allocated a value according to the same rules as are used with all number systems.

In decimal the place values are 1, 10, 100, 1000 etc. In binary we have place values for 1, 2, 4, 8, 16 etc up to 128 at the leftmost position in the byte. Each byte, as it has only 8 bits, can hold a maximum value (in decimal) up to 255. To see a chart of decimal to byte values click here.

A table of place values is here:
Place values in decimal, binary and hexadecimal
 Units
Decimal:100000001000000100000100001000100101
 Units
Binary:1286432168421
 Units
Hexadecimal:2684354561677721610485766553640962561601

Conversion

Sometimes we need to convert between binary and decimal. There are two C programs available to you to download and compile. One called b2d.c and the other called d2b.c - if you can't copy and paste them into your program editor and get them to compile, try right-clicking on the link and saving them directly into your cprogs folder. Examining and running these programs may give you a better idea how binary and decimal systems work.

Storage Capacity

While computer power is often measured in terms of bits - as in how many bits a computer can work with at a time, storage capacity is measured slightly differently.