Sei sulla pagina 1di 9

Binary & Decimal Conversions

Binary to Decimal & Back Again


Introduction to Binary Numbers
• Binary numbers are made up of binary digits, each digit
is called a BIT, taken from the words BI-nary digi-T.
Binary digits are either 0 or 1.
• Eight bits are grouped together to form a BYTE.
• Binary numbers are numbers just like decimal numbers
but are in base 2 instead of base 10. The base tells you
how many digits can be used.

In base 10 (decimal) there are 10:


0, 1, 2, 3, 4, 5, 6, 7, 8, 9
In base 2 (binary) there are 2:
0, 1
Binary to Decimal Conversion
Remember 8 bits = a BYTE and each bit has a positional
value so the first position is 20 = 1, the second position is
21 = 2, the third position is 22 = 4, and so on…
Take the binary number 11101 & place each in position.

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
1 1 1 0 1
Next take the value for that position. Add 16+8+4+1=29
notice 2 is not added in since its position has a 0,
so binary 11101 is equal to decimal 29
Check for Understanding
• What is the value of 00100101 ?
• What is the value of 11111110 ?
• What is the value of 10000001 ?

27 26 25 24 23 22 21 2 0
128 64 32 16 8 4 2 1
37 0 0 1 0 0 1 0 1
254 1 1 1 1 1 1 1 0
129 1 0 0 0 0 0 0 1
Decimal to Binary Conversion
Take the decimal number 75, look at each number starting
75
with 128, if it can be subtracted place a 1 otherwise place a
-64 0. The first number that can be subtracted is 64 so place a
0 below 128 & a 1 below 64. Subtract 64 from 75, the
11 remainder is 11. The next number that can be subtracted is
8 so place a 0 below 32, a 0 below 16, & a 1 below 8.
-8
Subtract 8 from 11, the remainder is 3. The next number
3 that can be subtracted is 2 so place a 0 below 4 & a 1
below the 2. Subtract 2 from 3, the remainder is 1. Place a
-2 1 below the 1 & subtract 1, the remainder is 0 and you have
1 the binary number 01001011
27 26 25 24 23 22 21 20
-1
128 64 32 16 8 4 2 1
0 0 1 0 0 1 0 1 1
Check for Understanding
• What is decimal 83 in binary?
• What is decimal 54 in binary?
• What is decimal 255 in binary?

27 26 25 24 23 22 21 2 0
128 64 32 16 8 4 2 1
83 0 1 0 1 0 0 1 1
54 0 0 1 1 0 1 1 0
255 1 1 1 1 1 1 1 1
Least Significant Bit (LSB)
• Let’s take another look at the binary number 01001011
• Notice we can drop the leading 0 and express the
binary number as 1001011
• This is because the least significant bit is the leftmost 1
which is necessary to maintain the accuracy of the
binary number
• Another way of expressing this is to ask what is the
least number of bits needed to express the binary
number 01001011 ? The answer is 7 (1001011)
• Or we can ask what is the least number of bits needed
to express 75? Again the answer is 7 (Notice this is a trick
question since we are asking about the number of bits.)
Check for Understanding
• What is the least number of bits needed
to express 3? 2 (binary number 11)
• What is the least number of bits needed
to express the binary number
00011010? 5 (binary number 11010)
• What is the least number of bits needed
to express 67? 7 (binary number 1000011)
BONUS Question:
• How can you tell quickly if a binary
number is odd or even?
If the last bit is 0 the decimal number will be even.
If the last bit is 1 the decimal number will be odd.
Final Check for Understanding

• Click on this link to bring


up the Binary-Decimal
Worksheet.
• Print & complete the
worksheet
• Turn in this worksheet
with your other
assignments.

Potrebbero piacerti anche