0% found this document useful (0 votes)
5 views23 pages

SPOILER - Differences Between Binary and Denary

The document outlines the differences between binary (base 2) and denary (base 10) numbering systems, highlighting their respective digits, place values, and conversion methods. It explains binary arithmetic, including addition and overflow errors, and details how to convert between binary and denary numbers using various methods. Additionally, it covers signed numbers using sign and magnitude representation and two's complement for negative values.

Uploaded by

avaitsme0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views23 pages

SPOILER - Differences Between Binary and Denary

The document outlines the differences between binary (base 2) and denary (base 10) numbering systems, highlighting their respective digits, place values, and conversion methods. It explains binary arithmetic, including addition and overflow errors, and details how to convert between binary and denary numbers using various methods. Additionally, it covers signed numbers using sign and magnitude representation and two's complement for negative values.

Uploaded by

avaitsme0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

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

Add the Place Values where 1 are presented…


512+128+64+16+8+2 = 730 (Denary)
Denary to Binary
Find the equivalent Binary number of 246.
Method 1 (Subtraction Method)
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
(128) (64) (32) (16) (8) (4) (2) (1)
Subtract the Place value from the given Denary number
in the question.
When subtracting , we have to note that
We need to subtract the Place Value starting from the
left.
So here , 246 – 128 = 118 (128 is subtractable)
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
(128) (64) (32) (16) (8) (4) (2) (1)
1 Write 1 under the subtractable number

Then we need to continue subtracting other Place value which is 64


from the ANSWER WE GOT FROM THE PREVIOUS SUBTRACTION.
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
(128) (64) (32) (16) (8) (4) (2) (1)
118 – 64 = 54 (64 is subtractable)
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
(128) (64) (32) (16) (8) (4) (2) (1)
1 1 Write another 1 under the subtractable
number

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0


(128) (64) (32) (16) (8) (4) (2) (1)
We continue the step 54– 32 = 22 (32 is subtractable)

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0


(128) (64) (32) (16) (8) (4) (2) (1)
1 1 1 Write another 1 under 32

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0


(128) (64) (32) (16) (8) (4) (2) (1)
Subtract 16 from the previous subtraction-answer ,22 so
22 – 16 = 6 ( 16 is subtractable)
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
(128) (64) (32) (16) (8) (4) (2) (1)
1 1 1 1 Write another 1 under 16
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
(128) (64) (32) (16) (8) (4) (2) (1)
Subtract 8 from the previous subtraction-answer ,6
But here.. we got a problem because
we can’t subtract 8 from 6 so we have to write 0 under 8.
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
(128) (64) (32) (16) (8) (4) (2) (1)
1 1 1 1 0 Write 0 under 8 <not subtractable>

 Then we have to subtract 4 from 6 which will get 2 , since it is


subtractable we have to write 1 under it.
 Next we can subtract 2 from 2 , which is got from the previous
subtraction and also here, it is subtractable so we have to write 1 .
 And finally we got 0 , the answer from the previous subtraction
which is 2-2=0 , but we can’t subtract the next “1” from 0.. so just
write 0… under the Place Value.
Here ..
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
(128) (64) (32) (16) (8) (4) (2) (1)
1 1 1 1 0 1 1 0
Denary 255 is equal to 1111 0 11 0 which is a Binary
number.
In summary for Method 1 , DB
 This method can be used for specific numbers ( 1,2
and some 3 digits numbers)
 Write the Binary number under the Denary value.
 Subtract these Place Value from the given Denary
number in the question until you get 0.
 If the number can be subtracted, write 1 under it.
 Can’t be subtracted, write 0 under it.
 You need to subtract other subtractable number
from the answer you got in the previous subtraction.

Method 2 (Dividing with 2)


 Divide the Denary number
with 2 until u get 0
 Mark the Remainder
 When writing Binary Number
 count the remainders
starting from downwards to
upwards
Binary Arithmetic
Calculating (operations) with Binary Numbers
The rule of Binary addition
 1+0 = 1 (write 1 , no carry over)
 1+1=10 (write 0 , carry 1)
 1+1+1=10 ( write 0 , carry 1)

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.

n bits + n bits = <maximum> n+1 bits = Overflow error


4bits+ 4 bits = 5 bits = Overflow error
Here maximum means the amount of 1 will be added to n ,
But if n bits + n bits = still making n bits and we can say that Overflow
error doesn’t occur in this case.
10 01 00 01 1 + 01 01 10 10 0 = 01 11 01 01 11 ( Overflow Error )
9 bits + 9 bits = 10 bits
Convert the following Denary numbers into Binary number and then
carry out the Binary addition of two number and check your answers
against the equivalent sum : 98 + 15 ( Ans 113 )

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

Answer checking ( Convert the Binary to Denary again )


First one = 64 + 32 + 2 = 98
Second one = 8 + 4 + 2 + 1 = 15

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

A)Binary 1100110 into Denary number


using Sign& Magnitude
1) Write down the Binary number under Place Values
Place Values 64 32 16 8 4 2 1
Number 1 1 0 0 0 1 1 0
2) The first “1” is cancelled because it represents the sign
( - ) minus
3) Next, add the Place values of where Binary bit “1” is
presented
64 + 4 + 2 = 70 => Not just 70 , -70 because the first bit 1
represents minus

B) Binary 01110110 into Denary number ( Normal Method )


128 64 32 16 8 4 2 1
0 1 1 1 0 1 1 0
64 + 32 + 16 + 4 + 2 = 118

Note : We start the place value from 64 .


C) Binary 11100011 into Denary number ( Normal Method )
128 64 32 16 8 4 2 1
1 1 1 0 0 0 1 1
128 + 64 + 32 + 2 + 1 = 227

Two Complement
Finding the two complement of a Binary Number
To find the two’s complement of a Binary number

Flip all of the bits-change 1 to 0 and 0 to 1


Add 1 to the result ( Use Binary addition method )

Convert -28 to Binary number


Find the two complements of = -28

Place value 128 64 32 16 8 4 2 1


Original Binary 0 0 0 1 1 1 0 0 ( Can subtract = 1 , can’t subtract = 0 )

Carry 1 1

Flipped Binary 1 1 1 0 0 0 1 1 ( 0 =>1 , 1=>0 )

Add 1 1 ( Binary Addition)


1 1 1 0 0 1 0 0 = -28
Converting Two’s Complement number back
into Denary
Method 1 : Place Value
Using place values , the two’s complement number
can be converted directly into denary.
Note : In Two’s Complement Method , the first
number is always negative so when we add the place
values to get denary , we mark 128 as “– 128” .
Standards have 8 bits , the first bit from left is negative.

1) Find the two’s complement Binary number 11100100


into Denary
-128 64 32 16 8 4 2 1
1 1 1 0 0 1 0 0
-128 + 64 + 32 + 4  -28

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 )

Convert 28 to Binary number


128 64 32 16 8 4 2 1
0 0 0 1 1 1 0 0 =28
Convert -28 to Binary number
Find the two complements of -28 (Negative to Positive )
Number 0 0 0 1 1 1 0 0 ( Positive 28 Binary )
Flip 1 1 1 0 0 0 1 1 ( 0=> 1 , 1=> 0 )
carry 1 1
Flipped Value 1 1 1 0 0 0 1 1
Add 1 1 ( Binary Addition )

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

128 64 32 16 8 4 2 1 Place value


0 0 0 1 1 1 0 0 = Unflipped binary digit and it is only 28 .not negative .

1 1 1 0 0 0 1 1 ( Flipped Binary no of -28 )

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 .

Note : Negative numbers can only be Flipped and Added one.

For the next one , In Edexcel u don’t have to write overflow


error in multiplication . But for CIE, u need to aware this
Binary Shift -1) Logical Shift 2)Arithmetic Shift
 An operation done on all bits of a Binary number of
places to either Left or Right.
 Can be used for Multiplication & Division by Power
of 2.

Logical Shift - Multiply ( to left )


1. Unsigned(positive) Binary number multiplication by
powers of 2.
2. Use left logical shift

i) < Without 1 > 000 10 100 * 2^1


^1 this means that we are moving 1 place to front
 If we arrange the numbers to forward , put 0 in the
back part of the missing places of each numbers.
 Front value to left = Back value put 0
 The number kicked out have to be written , if the
value is 1 .
0 0 0 1 0 1 0 0
0 0 0 1 0 1 0 0 0
000 10 100 * 2^1 = 0 0 0 1 0 10 0 0
ii) <With 1 > 100 11 0011 * 2^3
100 11 0011 000
 Spilt the first three digit &Write three zeros on back
 There is 1 in those 100 , so u have to take that 1 and
combine with other digits . <neglect other two 0s>
 1 11 0011 000

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

000 10 100 / 2^2


000 10 100  00 000 10 100  00 000 101
Put two zeros in front , neglect two digits from back

001 111 010 / 2^3


001 111 010 001 111 010 000 001 111
Neglect three digits from back , Put three zeros in front

1100 1000 / 2^2


1100 1000  1100 10 00  00 1100 10
Neglect two digits from back , Put two zeros in front.

000 10100 / 2^1


000 10100  000 1010 0  0 000 10100
Neglect one digit from back , Put on zero in front.
a) Convert 63 into 8bit Binary number
128 64 32 16 8 4 2 1
0 0 1 1 1 1 1 1
32+16+8+4+2+1 = 63  00 11 11 11 (Count until u reach that Denary number)

8 place = 8 Place values


b) Convert 37 into 8bit Binary number
128 64 32 16 8 4 2 1
0 0 1 0 0 1 0 1
32+4+1 = 37  001 001 01
c) Add together the result Binary number of a and b
1 1 1 1 1 1
0 0 1 1 1 1 1 1
0 0 1 0 0 1 0 1
0 1 1 0 0 1 0 0
d) Calculate the two places shift to the left of part c
using Logical Shift <to the left = Multiplication , two places=
2^2 >
0 1 1 0 0100  1 100 100  1 100 100 00
 Check first two digits , put one if it’s presented .
 Put two zeros in the back.
e) Convert the result of part d into Denary number
256 128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 0 0
256 + 128 + 16 = 400 ( Add the place values of 1 )

f) Marking that the answer of (e) has negative value but it is


113
convert this Singed Denary number into Binary using
Sign & Magnitude.

-113 < cancel the first place value>


128 64 32 16 8 4 2 1
1 1 1 1 0 0 0 1 1111 0001
Note:Why is the question wrong?
In Sign n magnitude methods, only 8 bits digits
can be converted but the answer of (f) has 9 bits.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy