DLD 2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

Binary Number

Representation
Binary Number Representation
• Signed
• Unsigned
Unsigned Numbers Representation
• Unsigned numbers contain only magnitude of the number.
• They don’t have any sign. That means all unsigned binary numbers are
positive.
• As in decimal number system, the placing of positive sign in front of
the number is optional for representing positive numbers.
• Therefore, all positive numbers including zero can be treated as
unsigned numbers if positive sign is not assigned in front of the
number.
Representation of Un-Signed Binary Numbers
• The bits present in the un-signed binary number holds the magnitude
of a number.
• That means, if the un-signed binary number contains ‘N’ bits, then all
N bits represent the magnitude of the number, since it doesn’t have
any sign bit.
• Example:
• Consider the decimal number 108. The binary equivalent of this number is
1101100.
• This is the representation of unsigned binary number.
• 10810 = 11011002
• It is having 7 bits. These 7 bits represent the magnitude of the number 108.
Signed Numbers Representation
• Signed numbers contain both sign and magnitude of
the number.
• Generally, the sign is placed in front of number. So, we
have to consider the positive sign for positive numbers
and negative sign for negative numbers. Therefore, all
numbers can be treated as signed numbers if the
corresponding sign is assigned in front of the number.
• If sign bit is zero, which indicates the binary number is
positive.
• Similarly, if sign bit is one, which indicates the binary
number is negative.
Representation of Signed Binary Numbers
• The Most Significant Bit MSB of signed binary numbers is used to
indicate the sign of the numbers. Hence, it is also called as sign bit.
• The positive sign is represented by placing ‘0’ in the sign bit.
• Similarly, the negative sign is represented by placing ‘1’ in the sign bit.
• If the signed binary number contains ‘N’ bits, then N−1 bits only
represent the magnitude of the number since one bit MSB is
reserved for representing sign of the number.
Types of Signed Binary Representation
• Sign-Magnitude form
• Complement form
• 1’s complement form
• 2’s complement form

• NOTE:
• Representation of a positive number in all these 3 forms is
same.
• But, only the representation of negative number will differ in
each form.
Representation of Signed Binary Numbers
Example: Consider the positive decimal number 108.
• The magnitude of this number is 108.
• We know the unsigned binary representation of 108 is 1101100.
• It is having 7 bits. All these bits represent the magnitude.
• Since the given number is positive, consider the sign bit as zero, which is placed
on left most side of magnitude.
• -10810 = 011011002

𝟎𝟏𝟏𝟎𝟏𝟏𝟎𝟎.
• Therefore, the signed binary representation of positive decimal number +108 is

• So, the same representation is valid in sign-magnitude form, 1’s complement form
and 2’s complement form for positive decimal number +108.
Sign-Magnitude Form
• Easiest for people to read (Not used by computers)
In sign-magnitude form:
• the MSB is used for representing sign of the number
and the remaining bits represent the magnitude of the
number.
• So, just include sign bit at the left most side of unsigned
binary number.
• This representation is similar to the signed decimal
numbers representation.
Sign-Magnitude Form
Example: Consider the negative decimal number -108.
• The magnitude of this number is 108.
• We know the unsigned binary representation of 108 is 1101100.
• It is having 7 bits. All these bits represent the magnitude.
• Since the given number is negative, consider the sign bit as one,
which is placed on left most side of magnitude.
• -10810 = 111011002
Example of complete list of binary SM numbers for a 4-bit word.
1’s Complement Form
• Also known as Diminished Radix Complement (DRC)
• Some computer systems use this information because it is easier to convert.

• The 1’s complement of a number is obtained by complementing


all the bits of signed binary number.
• So, 1’s complement of positive number gives a negative
number.
• Similarly, 1’s complement of negative number gives a positive
number.
• That means, if you perform two times 1’s complement of a binary
number including sign bit, then you will get the original signed
binary number.
Complements
• In digital computers to simplify the subtraction operation & for logical
manipulation complements are used.
• The Diminished Radix Complement (DRC)
• or (r-1)’s complement
• or 1’s Complement
• The Radix Complement (RC)
• or (r)’s complement
• or 2’s Complement

• Advantage of performing subtraction by the compliment method is reduction in


the hardware.
• instead of addition & subtraction only adding circuits are needed.
• For example: subtraction is also performed by adders only.
1’s Complement Form
Example: Consider the negative decimal number -108.
• The magnitude of this number is 108.
• We know the signed binary representation of 108 is 01101100.
• It is having 8 bits.
• The MSB of this number is zero, indicating positive number.
• Rest of the bits represent the magnitude.
• Complement of zero is one and one is zero.
• So, replace zeros by ones and ones by zeros
• in order to get the negative number. 01101100 >> 10010011
• Hence :
• -10810 = 10010011 2
2’s Complement Form
• Also known as Radix Complement (RC)
• The 2’s complement of a binary number is
obtained by adding one to the 1’s complement
of signed binary number.
• So, 2’s complement of positive number gives a negative number.
• Similarly, 2’s complement of negative number gives a positive number.
• That means, if you perform two times 2’s complement of a binary
number including sign bit, then you will get the original signed binary
number.
2’s Complement Form
Example : Consider the negative decimal number -108.
• We know the 1’s complement of (108)10 is (10010011)2
• From previous example

• 2’s compliment of 108 10 = 1’s compliment of 108 10 + 1

• = 10010011 + 1

• = 10010100

• Therefore, the 2’s complement of 10810 is 100101002.

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