SlideShare a Scribd company logo
3
Most read
7
Most read
8
Most read
3/28/2012
1
Digital Logic & Design
Dr. Sajjad Ahmed Nadeem
Department of Computer Science & IT
University of Azad Jammu & Kashmir
Muzaffarabad
Module 02_01
Complements.
The (r-1)’s Complement.
The r’s Complement.
Subtraction with Complements.
3/28/2012
2
Complements (1)
Used in digital computers for
◦ simplifying the subtraction operation
◦ logical manipulations.
There are two types of complements for each base-r
system:
1. The (r – 1)’s Complement (Diminished radix complement).
2. The r’s Complement (Radix complement).
For Decimal numbers we have 9’s and 10’s complement
For Binary numbers we have 1’s and 2’s complement
Complements (2)
Complements of numbers with fractions
1. Remove the radix point
2. Obtain the complement
3. Return the radix point to its position
3/28/2012
3
The (r – 1)’s Complement (1)
Let X be a positive number in base r with n
digits, the (r – 1)’s complement of X is defined
as
(rⁿ - 1) – X
For r=10, it is called 9’s complement and
is given by (10ⁿ - 1) – X
For r=2, it is called 1’s complement and is
given by (2ⁿ - 1) – X
The (r – 1)’s Complement (2)
The 9’s complement of (52520)10 is
{(105 – 1) – 52520} = 99999 – 52520 = 47479.
The 9’s complement of (0.3267)10 is
{(104 – 1) – 3267} = 9999 – 3267 = 6732.
(Answer is 0.6732.)
The 9’s complement of (25.639)10 is
(105– 1– 25639) = 99999 – 25639 = 74360.
(Answer is 74.360.)
3/28/2012
4
The (r – 1)’s Complement (3)
The 1’s complement of (101100)2 is
(26 – 1) 10 – (101100)2 = (111111 – 101100)2 =
010011.
The 1’s complement of (0.0110)2 is
(24 – 1)10 – (0110)2 = (1111 – 0110)2 = 1001.
(Answer is 0.1001)
The 1’s complement of (100.0110)2 is
(27 – 1)10 – (1000110)2 = (1111111 –
1000110)2 = 0111001.
(Answer is 011.1001)
The (r – 1)’s Complement (4)
The 9’s complement of a decimal number
is formed simply by subtracting every digit
from 9.
The 1’s complement of a binary number is
simpler to form: the 1’s are changed to 0’s
and 0’s to 1’s.
3/28/2012
5
The r’s Complement (1)
Let X be a positive number in base r with n
digits, the r’s complement of X is defined as
rⁿ – X for X ≠ 0
0 for X = 0
For r=10, it is called 10’s complement and
is given by 10ⁿ – X = (10ⁿ – 1) – X + 1
For r=2, it is called 2’s complement and is
given by 2ⁿ – X = (2ⁿ – 1) – X + 1
The r’s Complement (1)
The 10’s complement of (52520)10 is
(105 – 1) – 52520 + 1 = 47480.
(The number of digits in the number is n=5.)
The 10’s complement of (0.3267)10 is
(104 – 1) – 3267 + 1 = 6733
(Answer is 0.6733)
The 10’s complement of (25.639)10 is
(105 – 1) – 25639 + 1= 74361
(Answer is 74.361)
3/28/2012
6
The r’s Complement (2)
The 2’s Complement of (101100)2 is
{(26 – 1)10 – (101100)2 }+ 1
= (111111 – 101100)+1
= 010100.
The 2’s Complement of (0.0110)2 is
{(24 – 1)10 – (0110)2 }+ 1
= 1010.
(Answer is 0.1010)
The r’s Complement (3)
10’s complement can be formed by
◦ leaving all least significant zeros unchanged and
◦ then subtracting the first non-zero least significant
digit from 10, and
◦ then subtracting all other higher significant digits from
9.
The 2’s Complement can be formed by
◦ leaving all least significant zeros and first non zero
digit unchanged, and
◦ then replacing 1’s by 0’s and 0’s by 1’s in all other
higher significant digits.
3/28/2012
7
Complement of Complement
The complement of complement restores
the number to its original value.
The r’s complement of N is rⁿ - N.
Therefore, the complement of (rⁿ - N) is
rⁿ - (rⁿ - N)
= N
Subtraction with r’s compliment (1)
The subtraction of two positive numbers (M – N), both
of base r, may be done as follows.
1. Add the minuend M to the r’s complement of
subtrahend N.
M – N =M+ r’s complement (N)
2. Inspect the result obtained in step 1 for an end carry:
(a) If an end carry occurs discard it.
(b) If an end carry does not occur, take the r’s
complement of the number obtained in step 1, and
place a negative sign in front.
3/28/2012
8
Subtraction with r’s compliment (2)
Using 10’s complement,subtract 72532 – 3250.
M = 72532 , N = 03250.
10’s complement of subtrahend N = 96750.
Step 1: 72532
+ 96750
End Carry 1 69282
Step 2, discard carry.
Answer = 69282.
Subtraction with r’s compliment (3)
Subtract: (3250 – 72532)10
M = 03250,N = 72532.
10’s complement of N = 27468.
Step 1: 03250
+ 27468
30718 (No End Carry)
Step 2:Answer = - (10’s complement of 30718)
Answer = - 69282
3/28/2012
9
Subtraction with r’s compliment (4)
Using 2’s complement, subtract 1010100 –
1000100.
M = 1010100,N = 1000100.
2’s complement of N = 0111100
Step 1: 1010100
+ 0111100
End Carry 1 0010000
Step 2: Discard Carry.
Answer = 0010000
Subtraction with r’s compliment (5)
Using 2’s complement, subtract 1000100 –
1010100.
M = 1000100,N = 1010100.
2’s complement of N = 0101100
Step 1: 1000100
+ 0101100
No Carry 1110000
Step 2:Answer = - (2’s complement of 1110000)
Answer = - 0010000
3/28/2012
10
Subtraction with (r – 1)’s compliment (1)
The procedure for subtraction with the (r – 1)’s
complement is exactly the same as the one used with r’s
compliment except for one variation, called “end-round
carry”.
The subtraction of two positive numbers (M – N), both of
base r, may be done as follows.
1. Add the minuend M to the (r – 1)’s complement of the
subtrahend N.
M – N =M+ (r – 1)’s complement (N)
2. Inspect the result obtained in step 1 for an End carry.
(a) If an end carry occurs, add 1 to the least significant
digit ( end-around carry).
(b) If an end carry does not occur, take the (r – 1)’s
complement of the number obtained in step 1 and place
a negative sign in front.
Using 9’s complement, subtract 72532 – 3250.
M = 72532 , N = 03250.
9’s complement of subtrahend N = 96749.
Step 1: 72532
+ 96749
End-around Carry 1 69281
Step 2,add end around carry. + 1
Answer = 69282
Subtraction with (r – 1)’s compliment (2)
3/28/2012
11
Subtract: (3250 – 72532)10
M = 03250,N = 72532.
9’s complement of N = 27467.
Step 1: 03250
+ 27467
30717 (No End Carry)
Step 2:Answer = - (9’s complement of 30717)
Answer = - 69282
Subtraction with (r – 1)’s compliment (3)
Using 1’s complement, subtract 1010100 –
1000100.
M = 1010100,N = 1000100.
1’s complement of N = 0111011
Step 1: 1010100
+ 0111011
End Carry 1 0001111
Step 2 + 1
Answer = 0010000
Subtraction with (r – 1)’s compliment (4)
3/28/2012
12
Using 1’s complement, subtract 1000100 –
1010100.
M = 1000100,N = 1010100.
1’s complement of N = 0101011
Step 1: 1000100
+ 0101011
No Carry 1101111
Step 2:Answer = - (1’s complement of 1101111)
Answer = - 10000
Subtraction with (r – 1)’s compliment (5)
Signed Binary Numbers (1)
We have one way to represent a positive number
(say +9)
Three ways to represent a negative numbers (say -9)
Sign Bit
◦ Signed-magnitude representation 1 0001001
◦ Signed-1’s complement representation 1 1110110
◦ Signed-2’s complement representation 1 1110111
3/28/2012
13
Signed Binary Numbers (2)
Signed Binary Numbers-Addition
Addition of two numbers in signed magnitude system
follow the same rules of ordinary arithmatic.
The addition of two signed binary numbers
◦ Use binary representation of the numbers and add them
◦ In case of negative number, add the 2’s complement of the negative
number to the positive number alongwith sign bits
◦ Add the 2’s complement of the negative numbers
◦ A carry out of the sign bit position is discarded
◦ If the sum obtained is in negative it is automatically in 2’s
complement form.
3/28/2012
14
Signed Binary Numbers-Subtraction
Take the 2’s complement of the subtrahed (including the
sign bit)
Add the obtained 2’s complement to the minuend
(including the sign bit).
A carry out of sign bit is discarded
Assignment
r’s complement for octal & hexadecimal
(r-1)’s complement for octal &
hexadecimal
Comparison between 1’s and 2’s
Complement.

More Related Content

PPTX
Arithmetic micro operations
PDF
Magnitude comparator
PPTX
design of accumlator
PPTX
Complement in DLD
PDF
Registers and counters
PPTX
Unit 3 combinational circuits
PPTX
Assembly Language
PPT
Dbms ii mca-ch9-transaction-processing-2013
Arithmetic micro operations
Magnitude comparator
design of accumlator
Complement in DLD
Registers and counters
Unit 3 combinational circuits
Assembly Language
Dbms ii mca-ch9-transaction-processing-2013

What's hot (20)

PDF
Control Unit Design
PPTX
1s and 2s complement
PPTX
Butterfly network
PPTX
Behavioral modelling in VHDL
PPTX
SQL Joins.pptx
PPTX
Multiplication algorithm
PDF
Logic microoperations
PPTX
bus and memory tranfer (computer organaization)
PDF
Chapter 5The proessor status and the FLAGS registers
PPTX
state diagrams of flip flops
PDF
Sequential circuits in Digital Electronics
PPTX
memory reference instruction
PPT
multiplexers and demultiplexers
PPTX
(D/A) and (A/D)conversion
PPTX
Micro program example
PPT
counters.ppt
PPT
Two’s complement
PDF
Computer organization basics
PPTX
Microoperations
PPTX
Assembly language
Control Unit Design
1s and 2s complement
Butterfly network
Behavioral modelling in VHDL
SQL Joins.pptx
Multiplication algorithm
Logic microoperations
bus and memory tranfer (computer organaization)
Chapter 5The proessor status and the FLAGS registers
state diagrams of flip flops
Sequential circuits in Digital Electronics
memory reference instruction
multiplexers and demultiplexers
(D/A) and (A/D)conversion
Micro program example
counters.ppt
Two’s complement
Computer organization basics
Microoperations
Assembly language
Ad

Viewers also liked (20)

PDF
Dld lecture module 01
PDF
Basic+machine+organization
DOCX
English 01 application
PPTX
Number+system (1)
PDF
Dld lecture module 06
PDF
Graphical programming
PDF
PDF
Dld lecture module 03
DOCX
Operating Systems
PDF
Artificial intelligence
PDF
PDF
Complement
PDF
Dld lecture module 05
PDF
Algorithm defination, design & Implementation
PDF
Dld lecture module 04 01
PDF
Computer graphics
PPTX
PPTX
PDF
An introduction to software
Dld lecture module 01
Basic+machine+organization
English 01 application
Number+system (1)
Dld lecture module 06
Graphical programming
Dld lecture module 03
Operating Systems
Artificial intelligence
Complement
Dld lecture module 05
Algorithm defination, design & Implementation
Dld lecture module 04 01
Computer graphics
An introduction to software
Ad

Similar to Dld lecture module 02 (20)

PDF
Digital logic and design 02
PPT
Complements
PPTX
Complements of numbers
DOC
Digital 1
DOC
Kasthuri i bca
PPT
8 number-system
PPTX
Number system
PPTX
Binary Codes like Binary decimal Octal and Hexadecimal
PPT
1sand2scomplement r004
PPTX
1’s_and_2’s_Complements.pptx electronic notes
PPTX
1’s_and_2’s_Complements.pptx electronic note
PPT
compliments
PPTX
EC Binary Substraction using 1's Complement,2's Complement
PDF
1sand2scomplement.pdf
PPTX
1's and 2's complement.pptx
PPTX
1sand2scomplement.pptx
PDF
complement methods.pdf foto djhdfhkfdhkjhn sjsjknmcf
PDF
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
PPTX
Binary-Arithmeticcccccccccccccccccc.pptx
PPT
1’s and 2’s complements
Digital logic and design 02
Complements
Complements of numbers
Digital 1
Kasthuri i bca
8 number-system
Number system
Binary Codes like Binary decimal Octal and Hexadecimal
1sand2scomplement r004
1’s_and_2’s_Complements.pptx electronic notes
1’s_and_2’s_Complements.pptx electronic note
compliments
EC Binary Substraction using 1's Complement,2's Complement
1sand2scomplement.pdf
1's and 2's complement.pptx
1sand2scomplement.pptx
complement methods.pdf foto djhdfhkfdhkjhn sjsjknmcf
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
Binary-Arithmeticcccccccccccccccccc.pptx
1’s and 2’s complements

More from Bilal Maqbool ツ (19)

PPTX
Lecture 3 report writtng
PPTX
PPTX
Lecture 1 report writing
DOCX
Bill gates
DOCX
Programming assignment 02 (bilal maqbool 10) 2011
DOCX
Programming assignment 30 12-11
PPTX
Internet presentation
DOCX
Presentation internet programming report
DOCX
Magnetic storage devices
DOCX
How internet technology be used to spread scientific awareness among pakistan...
DOCX
Math assignment Program
DOCX
Final of sentences PPT
DOCX
Advantages and disadvantages of LCD
DOCX
A history of windows
PPTX
Bluetooth 27 01-12 PPT
DOCX
Bluetooth PPT Report
DOCX
Computing assignment 02 ms access (bilal maqbool 10) se-i
DOCX
Bilal maqbool assignment no.01 computing
Lecture 3 report writtng
Lecture 1 report writing
Bill gates
Programming assignment 02 (bilal maqbool 10) 2011
Programming assignment 30 12-11
Internet presentation
Presentation internet programming report
Magnetic storage devices
How internet technology be used to spread scientific awareness among pakistan...
Math assignment Program
Final of sentences PPT
Advantages and disadvantages of LCD
A history of windows
Bluetooth 27 01-12 PPT
Bluetooth PPT Report
Computing assignment 02 ms access (bilal maqbool 10) se-i
Bilal maqbool assignment no.01 computing

Recently uploaded (20)

PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Pre independence Education in Inndia.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
master seminar digital applications in india
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Microbial disease of the cardiovascular and lymphatic systems
O7-L3 Supply Chain Operations - ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
01-Introduction-to-Information-Management.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Cell Structure & Organelles in detailed.
Pre independence Education in Inndia.pdf
Cell Types and Its function , kingdom of life
master seminar digital applications in india
O5-L3 Freight Transport Ops (International) V1.pdf
GDM (1) (1).pptx small presentation for students
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Complications of Minimal Access Surgery at WLH
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student

Dld lecture module 02

  • 1. 3/28/2012 1 Digital Logic & Design Dr. Sajjad Ahmed Nadeem Department of Computer Science & IT University of Azad Jammu & Kashmir Muzaffarabad Module 02_01 Complements. The (r-1)’s Complement. The r’s Complement. Subtraction with Complements.
  • 2. 3/28/2012 2 Complements (1) Used in digital computers for ◦ simplifying the subtraction operation ◦ logical manipulations. There are two types of complements for each base-r system: 1. The (r – 1)’s Complement (Diminished radix complement). 2. The r’s Complement (Radix complement). For Decimal numbers we have 9’s and 10’s complement For Binary numbers we have 1’s and 2’s complement Complements (2) Complements of numbers with fractions 1. Remove the radix point 2. Obtain the complement 3. Return the radix point to its position
  • 3. 3/28/2012 3 The (r – 1)’s Complement (1) Let X be a positive number in base r with n digits, the (r – 1)’s complement of X is defined as (rⁿ - 1) – X For r=10, it is called 9’s complement and is given by (10ⁿ - 1) – X For r=2, it is called 1’s complement and is given by (2ⁿ - 1) – X The (r – 1)’s Complement (2) The 9’s complement of (52520)10 is {(105 – 1) – 52520} = 99999 – 52520 = 47479. The 9’s complement of (0.3267)10 is {(104 – 1) – 3267} = 9999 – 3267 = 6732. (Answer is 0.6732.) The 9’s complement of (25.639)10 is (105– 1– 25639) = 99999 – 25639 = 74360. (Answer is 74.360.)
  • 4. 3/28/2012 4 The (r – 1)’s Complement (3) The 1’s complement of (101100)2 is (26 – 1) 10 – (101100)2 = (111111 – 101100)2 = 010011. The 1’s complement of (0.0110)2 is (24 – 1)10 – (0110)2 = (1111 – 0110)2 = 1001. (Answer is 0.1001) The 1’s complement of (100.0110)2 is (27 – 1)10 – (1000110)2 = (1111111 – 1000110)2 = 0111001. (Answer is 011.1001) The (r – 1)’s Complement (4) The 9’s complement of a decimal number is formed simply by subtracting every digit from 9. The 1’s complement of a binary number is simpler to form: the 1’s are changed to 0’s and 0’s to 1’s.
  • 5. 3/28/2012 5 The r’s Complement (1) Let X be a positive number in base r with n digits, the r’s complement of X is defined as rⁿ – X for X ≠ 0 0 for X = 0 For r=10, it is called 10’s complement and is given by 10ⁿ – X = (10ⁿ – 1) – X + 1 For r=2, it is called 2’s complement and is given by 2ⁿ – X = (2ⁿ – 1) – X + 1 The r’s Complement (1) The 10’s complement of (52520)10 is (105 – 1) – 52520 + 1 = 47480. (The number of digits in the number is n=5.) The 10’s complement of (0.3267)10 is (104 – 1) – 3267 + 1 = 6733 (Answer is 0.6733) The 10’s complement of (25.639)10 is (105 – 1) – 25639 + 1= 74361 (Answer is 74.361)
  • 6. 3/28/2012 6 The r’s Complement (2) The 2’s Complement of (101100)2 is {(26 – 1)10 – (101100)2 }+ 1 = (111111 – 101100)+1 = 010100. The 2’s Complement of (0.0110)2 is {(24 – 1)10 – (0110)2 }+ 1 = 1010. (Answer is 0.1010) The r’s Complement (3) 10’s complement can be formed by ◦ leaving all least significant zeros unchanged and ◦ then subtracting the first non-zero least significant digit from 10, and ◦ then subtracting all other higher significant digits from 9. The 2’s Complement can be formed by ◦ leaving all least significant zeros and first non zero digit unchanged, and ◦ then replacing 1’s by 0’s and 0’s by 1’s in all other higher significant digits.
  • 7. 3/28/2012 7 Complement of Complement The complement of complement restores the number to its original value. The r’s complement of N is rⁿ - N. Therefore, the complement of (rⁿ - N) is rⁿ - (rⁿ - N) = N Subtraction with r’s compliment (1) The subtraction of two positive numbers (M – N), both of base r, may be done as follows. 1. Add the minuend M to the r’s complement of subtrahend N. M – N =M+ r’s complement (N) 2. Inspect the result obtained in step 1 for an end carry: (a) If an end carry occurs discard it. (b) If an end carry does not occur, take the r’s complement of the number obtained in step 1, and place a negative sign in front.
  • 8. 3/28/2012 8 Subtraction with r’s compliment (2) Using 10’s complement,subtract 72532 – 3250. M = 72532 , N = 03250. 10’s complement of subtrahend N = 96750. Step 1: 72532 + 96750 End Carry 1 69282 Step 2, discard carry. Answer = 69282. Subtraction with r’s compliment (3) Subtract: (3250 – 72532)10 M = 03250,N = 72532. 10’s complement of N = 27468. Step 1: 03250 + 27468 30718 (No End Carry) Step 2:Answer = - (10’s complement of 30718) Answer = - 69282
  • 9. 3/28/2012 9 Subtraction with r’s compliment (4) Using 2’s complement, subtract 1010100 – 1000100. M = 1010100,N = 1000100. 2’s complement of N = 0111100 Step 1: 1010100 + 0111100 End Carry 1 0010000 Step 2: Discard Carry. Answer = 0010000 Subtraction with r’s compliment (5) Using 2’s complement, subtract 1000100 – 1010100. M = 1000100,N = 1010100. 2’s complement of N = 0101100 Step 1: 1000100 + 0101100 No Carry 1110000 Step 2:Answer = - (2’s complement of 1110000) Answer = - 0010000
  • 10. 3/28/2012 10 Subtraction with (r – 1)’s compliment (1) The procedure for subtraction with the (r – 1)’s complement is exactly the same as the one used with r’s compliment except for one variation, called “end-round carry”. The subtraction of two positive numbers (M – N), both of base r, may be done as follows. 1. Add the minuend M to the (r – 1)’s complement of the subtrahend N. M – N =M+ (r – 1)’s complement (N) 2. Inspect the result obtained in step 1 for an End carry. (a) If an end carry occurs, add 1 to the least significant digit ( end-around carry). (b) If an end carry does not occur, take the (r – 1)’s complement of the number obtained in step 1 and place a negative sign in front. Using 9’s complement, subtract 72532 – 3250. M = 72532 , N = 03250. 9’s complement of subtrahend N = 96749. Step 1: 72532 + 96749 End-around Carry 1 69281 Step 2,add end around carry. + 1 Answer = 69282 Subtraction with (r – 1)’s compliment (2)
  • 11. 3/28/2012 11 Subtract: (3250 – 72532)10 M = 03250,N = 72532. 9’s complement of N = 27467. Step 1: 03250 + 27467 30717 (No End Carry) Step 2:Answer = - (9’s complement of 30717) Answer = - 69282 Subtraction with (r – 1)’s compliment (3) Using 1’s complement, subtract 1010100 – 1000100. M = 1010100,N = 1000100. 1’s complement of N = 0111011 Step 1: 1010100 + 0111011 End Carry 1 0001111 Step 2 + 1 Answer = 0010000 Subtraction with (r – 1)’s compliment (4)
  • 12. 3/28/2012 12 Using 1’s complement, subtract 1000100 – 1010100. M = 1000100,N = 1010100. 1’s complement of N = 0101011 Step 1: 1000100 + 0101011 No Carry 1101111 Step 2:Answer = - (1’s complement of 1101111) Answer = - 10000 Subtraction with (r – 1)’s compliment (5) Signed Binary Numbers (1) We have one way to represent a positive number (say +9) Three ways to represent a negative numbers (say -9) Sign Bit ◦ Signed-magnitude representation 1 0001001 ◦ Signed-1’s complement representation 1 1110110 ◦ Signed-2’s complement representation 1 1110111
  • 13. 3/28/2012 13 Signed Binary Numbers (2) Signed Binary Numbers-Addition Addition of two numbers in signed magnitude system follow the same rules of ordinary arithmatic. The addition of two signed binary numbers ◦ Use binary representation of the numbers and add them ◦ In case of negative number, add the 2’s complement of the negative number to the positive number alongwith sign bits ◦ Add the 2’s complement of the negative numbers ◦ A carry out of the sign bit position is discarded ◦ If the sum obtained is in negative it is automatically in 2’s complement form.
  • 14. 3/28/2012 14 Signed Binary Numbers-Subtraction Take the 2’s complement of the subtrahed (including the sign bit) Add the obtained 2’s complement to the minuend (including the sign bit). A carry out of sign bit is discarded Assignment r’s complement for octal & hexadecimal (r-1)’s complement for octal & hexadecimal Comparison between 1’s and 2’s Complement.