SPOILER - Differences Between Binary and Denary
SPOILER - Differences Between Binary and Denary
Binary
o Is a Base 2 numbering system
o Digits are 0 and 1 only
o Computer understandable system
o Digits are called as Bits
o Power/index are increased by 1 from Right to left
o Place value 10 power n
Denary
Base 1- numbering system
Digits start from 0 to 9
Human understandable system
We call them as the number of their digits
N is increased from right to left
Place value = 2 power n
Similarities
In Standards, there are at least 8 Bits/Digits in both.
U have to replace 0 in front of the number if there less than 8
digits
Both are Numbering system used for counting data.
They both have digits which have Place Values according to their
position in the numerical system
Both can be converted to each other by using specific methods.
Conversions
Binary to Denary
# Find the equivalent Denary number of 1011011010
These are Place values; u should write them as the number of
Bits in the Binary Number
2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
512 256 128 64 32 16 8 4 2 1
2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
512 256 128 64 32 16 8 4 2 1
1 0 1 1 0 1 1 0 1 0
Write down the given Binary number from the Question
2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
512 256 128 64 32 16 8 4 2 1
1 0 1 1 0 1 1 0 1 0
1+1+1 = 1 , carry 1 = 11
1 11010110 + 00100111 =
1 8 bits + 8 bits = Maximum 9 bits (Error)
+1 1 1
_1 1 1 0 1 0 1 10
11 0 0 1 0 0 1 11
1 1 1 1 1 1 0 1
Overflow error
Doesn’t occur in 0 , cause there is no data.
This condition occurs when a calculation produces a result that is
greater than a computer can store.
When this happens , the (Micro)processor , CPU is informed that
an error has occurred.
Not only 8 Binary + 8 Binary making, 9 binary bits
Eg 7 ---- +7----- making 8
2----+ 2—making 3 binary bits
3----- + 3----- making 4 binary bits as so on.
If the added digits is more than the number of two values, an error will
be occurred so we have to write
“Overflow error” with bracket behind the bits
8 bits binary number + 8 bits binary number = 9 bits so
Write the sum of their Binary digits and the text “ Overflow error”
with bracket behind them.
98
128 64 32 16 8 4 2 1
0 1 1 0 0 0 1 0
15
128 64 32 16 8 4 2 1
0 0 0 0 1 1 1 1
Add two Binary codes
1 1 1
0 1 1 0 0 0 1 0
0 0 0 0 1 1 1 1
0 1 1 1 0 0 0 1
0 1 1 1 0 0 0 1
128 64 32 16 8 4 2 1 64 + 32 + 16 + 1 => 113
How are signed/negative Denary number changed
to Binary number
Sign and Magnitude
In this method, most significant bit represents the sign bit that
indicates whether the number is positive 0 or negative 1
The rest of the bits in the pattern store the size of the number
“Magnitude”
01 10 01 11
Here the first bit “0” is called the Sign bit
While the other 7 bits are called as Magnitude.
First bit 0 = Positive Denary
First bit 1 = Negative Denary
Convert -28 to Binary number using Sign & Magnitude
Place Value 64 32 16 8 4 2 1
1 0 0 1 1 1 0 0
The “1” in the first is cancelled as the Sign Bit ( - )
So we have to add other place values to get 28 as the previous
ones.
If we can subtract write 1, if we cant skip the number and write 0
After that , we add the subtractable Place values to get a Denary.
16 + 8 + 4 + => 28 => not only 28 , don’t forget that we used “1”
as minus => so -28
Converting Sign & Magnitude Binary back into
Denary
Two Complement
Finding the two complement of a Binary Number
To find the two’s complement of a Binary number
Carry 1 1
2) 10 11 10 11 into Denary
-128 64 32 16 8 4 2 1
1 0 1 1 1 0 1 1
-128 + 32 + 16 + 8 + 2 + 1 =69
Find the following (A) Two’s complement Binary
(B) Sign and Magnitude
into Denary number
a) 11 11 01 11
A) -128 64 32 16 8 4 2 1
1 1 1 1 0 1 1 1
-128 + 64 + 32 + 16 + 4 + 2 + 1 = = -9
Need to write -128 and use it in the addition , get
negative Denary because here , it starts with 1 .
B) 64 32 16 8 4 2 1
-1 1 1 1 0 1 1 1
64 + 32 + 16 + 4 + 2 + 1 - 119
Starts with 64 (No need to write -128) but have to know that if
the binary digit starts with 1 ,u need to neglect it.
Also get a negative Denary
Note :The answers are not the same as they are worked out
by using two different methods.
2) 11011011
A) -128 64 32 16 8 4 2 1
1 1 0 1 1 0 1 1
-128 + 16 + 4 + 2 + 1 = -105
B) 64 32 16 8 4 2 1
-1 1 0 1 1 0 1 1
64 + 16 + 8 + 2 + 1 - 91
3) 1000 1111
A) -128 64 32 16 8 4 2 1
1 0 0 0 1 1 1 1
-128 + 8 + 4 + 2 + 1 = -105
B) 64 32 16 8 4 2 1
-1 0 0 0 1 1 1 1
8+4 +2+1 -15
Adding Signed Integer
Find the Binary addition of 28 + ( -28 )
1 1 1 0 0 1 0 0 = -28
2Add the two Binary of positive 8 and negative 8.
For negative 8 , add the Flipped Value , not the original Binary.
1 1 1 1 1
0 0 0 1 1 1 0 0
+ 1 1 1 0 0 0 1 1
1 0 0 0 0 0 0 0 0
Find the Binary addition of 5 + ( -28)
128 64 32 16 8 4 2 1 Place value
0 0 0 0 0 1 0 1 = 5
1 1 carry
1 1 1 0 0 0 1 1
1 add one
1 1 1 0 0 1 0 0
1
0 0 0 0 0 1 0 1
1 1 1 0 0 1 0 0
1 1 1 0 0 1 0 1
Finally add the two Binary digits .
00011001 * 2^4
0001 1001 0000
Spilt first four digits . Write four zeros on the back
right.
One “1” there, so rewrite it when writing Binary.
1 1001 0000
01111010 * 2^3
011 11010 000
Spilt first three digits , Write three zeros on the back
Two “1” there , so rewrite them when writing
Binary.
11 11010 000
Division (Right)
Unsigned Binary number division by power of 2
Used Right Logical Shift