21st November 2009 search this site | sitemap | advertise 

  Binary Numbers - An intro along with conversion formulas

binary numbers Welcome to our binary numbers guide.

In this section we will explain what binary is and show you how to convert between binary and decimal (denary) numbers.

In subsequent sections we will show you how to perform various mathematical operations on binary numbers.
spr
This page is © Copyright 2001-2009 helpwithpcs.com
spr

In part one:

spr

Binary Numbers Overview

Binary is a number system used by digital devices like computers, cd players, etc.

Binary is Base 2, unlike our counting system decimal which is Base 10 (denary).

In other words, Binary has only 2 different numerals (0 and 1) to denote a value, unlike Decimal which has 10 numerals (0,1,2,3,4,5,6,7,8 and 9).

Here is an example of a binary number: 10011100

As you can see it is simply a bunch of zeroes and ones, there are 8 numerals in all which make this an 8 bit binary number. Bit is short for Binary Digit, and each numeral is classed as a bit.

The bit on the far right, in this case a 0, is known as the Least significant bit (LSB).

The bit on the far left, in this case a 1, is known as the Most significant bit (MSB)
spr
notations used in digital systems:
4 bits = Nibble
8 bits = Byte
16 bits = Word
32 bits = Double word
64 bits = Quad Word (or paragraph)
spr
When writing binary numbers you will need to signify that the number is binary (base 2), for example, let's take the value 101. As it is written, it would be hard to work out whether it is a binary or decimal (denary) value. To get around this problem it is common to denote the base to which the number belongs, by writing the base value with the number, for example:

1012 is a binary number and 10110 is a decimal (denary) value.

Once we know the base then it is easy to work out the value, for example:

1012 = 1*22 + 0*21 + 1*20 = 5 (five)

10110 = 1*102 + 0*101 + 1*100 = 101 (one hundred and one)

One other thing about binary numbers is that it is common to signify a negative binary value by placing a 1 (one) at the left hand side (most significant bit) of the value. This is called a sign bit, we will discuss this in more detail in the next part of the tutorial.
spr
Electronically binary numbers are stored/processed using off or on electrical pulses, a digital system will interpret these off and on states as 0 and 1. In other words if the voltage is low then it would represent 0 (off state), and if the voltage is high then it would represent a 1 (on state).
spr
© Copyright 2001-2009 helpwithpcs.com
spr
Back to top | Binary Numbers Part 2 - Adding & subtracting binary values
spr

Converting binary to decimal

To convert binary into decimal is very simple and can be done as shown below:

Say we want to convert the 8 bit value 10011101 into a decimal value, we can use a formula like that below:

128 64 32 16 8 4 2 1
1 0 0 1 1 1 0 1

As you can see, we have placed the numbers 1, 2, 4, 8, 16, 32, 64, 128 (powers of two) in reverse numerical order, and then written the binary value below.

To convert, you simply take a value from the top row wherever there is a 1 below, and then add the values together.

For instance, in our example we would have 128 + 16 + 8 + 4 + 1 = 157.

For a 16 bit value you would use the decimal values 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 (powers of two) for the conversion.

Because we know binary is base 2 then the above could be written as:

1*27 + 0*26 + 0*25 + 1*24 + 1*23 + 1*22 + 0*21 + 1*20 = 157.
spr
© Copyright 2001-2009 helpwithpcs.com
spr
Back to top | Binary Numbers Part 2 - Adding & subtracting binary values
spr

Converting decimal to binary

To convert decimal to binary is also very simple, you simply divide the decimal value by 2 and then write down the remainder, repeat this process until you cannot divide by 2 anymore, for example let's take the decimal value 157:

157 ÷ 2 = 78
78 ÷ 2 = 39
39 ÷ 2 = 19
19 ÷ 2 = 9
9 ÷ 2 = 4
4 ÷ 2 = 2
2 ÷ 2 = 1
1 ÷ 2 = 0
with a remainder of 1
with a remainder of 0
with a remainder of 1
with a remainder of 1
with a remainder of 1
with a remainder of 0
with a remainder of 0
with a remainder of 1
<--- to convert write this remainder first.

Next write down the value of the remainders from bottom to top (in other words write down the bottom remainder first and work your way up the list) which gives:

10011101 = 157
spr
© Copyright 2001-2009 helpwithpcs.com
spr
Back to top | Binary Numbers Part 2 - Adding & subtracting binary values
spr