Computer
Arithmetic
KAMRAN RIASAT … 18
MUHAMMAD HASNAIN … 29
MUHAMMAD SAIF ULLAH … 30
USAMA ALI … 38
Chapter 09
Arithmetic & Logic Unit (ALU)
 Part of the computer that actually performs
arithmetic and logical operations on data
 All of the other elements of the computer system
are there mainly to bring data into the ALU for it to
process and then to take the results back out
 Based on the use of simple digital logic devices
that can store binary digits and perform simple
Boolean logic operations
ALU
Inputs
and
Outputs
Integer represention
Integer Representation
 In the binary number system arbitrary numbers can be
represented with:
▪ The digits zero and one
▪ The minus sign (for negative numbers)
▪ The period, or radix point (for numbers with a fractional component)
 For purposes of computer storage and processing we do not have
the benefit of special symbols for the minus sign and radix point
 Only binary digits (0,1) may be used to represent numbers
Sign-Magnitude Representation
 Left most bit is sign bit
 0 means positive
 1 means negative
 Drawbacks:
▪ Need to consider both sign and magnitude in arithmetic
▪ Two representations of zero (+0 and -0)
 Rarely used in implementing the integer portion of the ALU
Twos Complement Representation
 Uses the most significant bit as a sign bit
 Differs from sign-magnitude representation in the way that the other bits
are interpreted
Table 9.2
Alternative Representations for 4-Bit Integers
Benefits
 One representation of zero
 Arithmetic works easily (see later)
 Negating is fairly easy
▪ 3 = 00000011
▪ Boolean complement gives 11111100
▪ Add 1 to LSB 11111101
Range Extension
 Range of numbers that can be expressed is extended by
increasing the bit length
 In sign-magnitude notation this is accomplished by moving the
sign bit to the new leftmost position and fill in with zeros
 This procedure will not work for twos complement negative
integers
▪Rule is to move the sign bit to the new leftmost position and fill in with
copies of the sign bit
▪For positive numbers, fill in with zeros, and for negative numbers, fill in
with ones
▪This is called sign extension
Fixed-Point Representation
The radix point (binary point)
is fixed and assumed to be to
the right of the rightmost digit
Programmer can use the
same representation for
binary fractions by scaling the
numbers so that the binary
point is implicitly positioned
at some other location
Integer Arithmetic
Negation(Twos Complement)
 Twos complement operation
▪ Take the Boolean complement of each bit of the integer (including the sign bit)
▪ Treating the result as an unsigned binary integer, add 1
 The negative of the negative of that number is itself:
+18 = 00010010 (twos complement)
bitwise complement = 11101101
+ 1
11101110 = -18
-18 = 11101110 (twos complement)
bitwise complement = 00010001
+ 1
00010010 = +18
Addition
OVERFLOW RULE:
 If two numbers are added, and they are both positive or
both negative, then overflow occurs if and only if the result
has the opposite sign.
Negation Special Case 1
0 = 00000000 (twos complement)
Bitwise complement = 11111111
Add 1 to LSB + 1
Result 100000000
Overflow is ignored, so:
- 0 = 0
Negation Special Case 2
-128 = 10000000 (twos complement)
Bitwise complement = 01111111
Add 1 to LSB + 1
Result 10000000
So:
-(-128) = -128 X
Monitor MSB (sign bit)
It should change during negation
SUBTRACTION RULE:
Rules:
1. To subtract one number (subtrahend) from another
(minuend)
2. Take the twos complement (negation) of the subtrahend
3. And add it to the minuend.
Subtraction
Hardware for Addition and
Subtraction
Figure 9.6 Block diagram of Hardware for Addition and Subtraction
MULTIPLICATION
Multiplication
 Complex
 Work out partial product for each digit
 Take care with place value (column)
 Add partial product
Multiplication Example
1011 Multiplicand (11 dec)
x 1101 Multiplier (13 dec)
1011 Partial products
0000x Note: if multiplier bit is 1 copy
1011xx Multiplicand (place value)
1011xxx Otherwise zero
10001111 Product (143 dec)
Note: need double length result`
Execution of Example
Flowchart for Unsigned Binary
Multiplication
Multiplying Negative Numbers
This does not work!
Solution 1
▪ Convert to positive if required
▪ Multiply as above
▪ If signs were different, negate answer
Solution 2
▪ Booth’s algorithm
Booth’s
Algorithm
Example of Booth’s Algorithm
Examples Using Booth’s Algorithm
Division
Flowchart for
Unsigned
Binary
Division
Example of Restoring Twos Complement
Division
Thank You

More Related Content

PDF
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)
PPT
09 Arithmetic
PPT
09 arithmetic
PPTX
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
PPTX
Arithmetic for Computers
PPT
Addition and subtraction with signed magnitude data (mano
PPS
Arithmetic Operations
PPT
Arithmetic circuits
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)
09 Arithmetic
09 arithmetic
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
Arithmetic for Computers
Addition and subtraction with signed magnitude data (mano
Arithmetic Operations
Arithmetic circuits

What's hot (19)

PPT
09 arithmetic
PPTX
Signed Addition And Subtraction
PPTX
Computer arithmetic
PPTX
Floating point arithmetic operations (1)
PPT
05 multiply divide
PPTX
PDF
Lecture2 binary multiplication
PDF
Chapter 05 computer arithmetic
PPTX
Computer arithmetic
PPT
arithmetic
PPTX
Multiplication algorithm
PPTX
B.sc cs-ii-u-1.3 digital logic circuits, digital component
PPTX
Bca 2nd sem-u-1.3 digital logic circuits, digital component
PPTX
Multiplication algorithm, hardware and flowchart
PPTX
Computer architecture data representation
PPTX
Data Reprersentation
PPTX
Booths algorithm for Multiplication
PDF
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
PPT
Computer architecture
09 arithmetic
Signed Addition And Subtraction
Computer arithmetic
Floating point arithmetic operations (1)
05 multiply divide
Lecture2 binary multiplication
Chapter 05 computer arithmetic
Computer arithmetic
arithmetic
Multiplication algorithm
B.sc cs-ii-u-1.3 digital logic circuits, digital component
Bca 2nd sem-u-1.3 digital logic circuits, digital component
Multiplication algorithm, hardware and flowchart
Computer architecture data representation
Data Reprersentation
Booths algorithm for Multiplication
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
Computer architecture
Ad

Similar to Integer represention (20)

PPT
Computer Arithmetic_Computer_Architecture.ppt
PPTX
CH10-COA10e.pptx
PPTX
ALU.pptx kjvjjfjrshfjshfjrhfjershfherjghre
PPT
Counit2
PPTX
Computer Architecture
PPTX
Computer Architecture
PDF
Computer arithmetic
PPT
Number system and codes
PPT
lec2_BinaryArithmetic.ppt
PPT
Mba admission in india
PPTX
Computer arithmetics (computer organisation & arithmetics) ppt
PPTX
CA Unit ii
PDF
Computer arithmetics coa project pdf version
PPT
09 arithmetic
PPT
09 arithmetic 2
PPTX
DE -gxgxhxydydydfyfduffuf UEEB02 - L 7.pptx
PPTX
L3 ARITHMETIC OPERATIONS.pptx
PPT
Mba admission in india
PPTX
Chapter_02_The_Language_of_Bits_Any.pptx
PDF
N akkk4lmealkkk3eqklaflerkpwoerkwflskkes
Computer Arithmetic_Computer_Architecture.ppt
CH10-COA10e.pptx
ALU.pptx kjvjjfjrshfjshfjrhfjershfherjghre
Counit2
Computer Architecture
Computer Architecture
Computer arithmetic
Number system and codes
lec2_BinaryArithmetic.ppt
Mba admission in india
Computer arithmetics (computer organisation & arithmetics) ppt
CA Unit ii
Computer arithmetics coa project pdf version
09 arithmetic
09 arithmetic 2
DE -gxgxhxydydydfyfduffuf UEEB02 - L 7.pptx
L3 ARITHMETIC OPERATIONS.pptx
Mba admission in india
Chapter_02_The_Language_of_Bits_Any.pptx
N akkk4lmealkkk3eqklaflerkpwoerkwflskkes
Ad

Recently uploaded (20)

PPTX
communication and presentation skills 01
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PDF
Soil Improvement Techniques Note - Rabbi
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PDF
ChapteR012372321DFGDSFGDFGDFSGDFGDFGDFGSDFGDFGFD
PDF
737-MAX_SRG.pdf student reference guides
PPTX
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
PPT
Total quality management ppt for engineering students
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PDF
Improvement effect of pyrolyzed agro-food biochar on the properties of.pdf
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
Amdahl’s law is explained in the above power point presentations
PPTX
introduction to high performance computing
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PPTX
Information Storage and Retrieval Techniques Unit III
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PDF
August -2025_Top10 Read_Articles_ijait.pdf
communication and presentation skills 01
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
Soil Improvement Techniques Note - Rabbi
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
ChapteR012372321DFGDSFGDFGDFSGDFGDFGDFGSDFGDFGFD
737-MAX_SRG.pdf student reference guides
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
Total quality management ppt for engineering students
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
Categorization of Factors Affecting Classification Algorithms Selection
Improvement effect of pyrolyzed agro-food biochar on the properties of.pdf
Exploratory_Data_Analysis_Fundamentals.pdf
Amdahl’s law is explained in the above power point presentations
introduction to high performance computing
August 2025 - Top 10 Read Articles in Network Security & Its Applications
Information Storage and Retrieval Techniques Unit III
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
August -2025_Top10 Read_Articles_ijait.pdf

Integer represention

  • 1. Computer Arithmetic KAMRAN RIASAT … 18 MUHAMMAD HASNAIN … 29 MUHAMMAD SAIF ULLAH … 30 USAMA ALI … 38 Chapter 09
  • 2. Arithmetic & Logic Unit (ALU)  Part of the computer that actually performs arithmetic and logical operations on data  All of the other elements of the computer system are there mainly to bring data into the ALU for it to process and then to take the results back out  Based on the use of simple digital logic devices that can store binary digits and perform simple Boolean logic operations
  • 5. Integer Representation  In the binary number system arbitrary numbers can be represented with: ▪ The digits zero and one ▪ The minus sign (for negative numbers) ▪ The period, or radix point (for numbers with a fractional component)  For purposes of computer storage and processing we do not have the benefit of special symbols for the minus sign and radix point  Only binary digits (0,1) may be used to represent numbers
  • 6. Sign-Magnitude Representation  Left most bit is sign bit  0 means positive  1 means negative  Drawbacks: ▪ Need to consider both sign and magnitude in arithmetic ▪ Two representations of zero (+0 and -0)  Rarely used in implementing the integer portion of the ALU
  • 7. Twos Complement Representation  Uses the most significant bit as a sign bit  Differs from sign-magnitude representation in the way that the other bits are interpreted
  • 9. Benefits  One representation of zero  Arithmetic works easily (see later)  Negating is fairly easy ▪ 3 = 00000011 ▪ Boolean complement gives 11111100 ▪ Add 1 to LSB 11111101
  • 10. Range Extension  Range of numbers that can be expressed is extended by increasing the bit length  In sign-magnitude notation this is accomplished by moving the sign bit to the new leftmost position and fill in with zeros  This procedure will not work for twos complement negative integers ▪Rule is to move the sign bit to the new leftmost position and fill in with copies of the sign bit ▪For positive numbers, fill in with zeros, and for negative numbers, fill in with ones ▪This is called sign extension
  • 11. Fixed-Point Representation The radix point (binary point) is fixed and assumed to be to the right of the rightmost digit Programmer can use the same representation for binary fractions by scaling the numbers so that the binary point is implicitly positioned at some other location
  • 13. Negation(Twos Complement)  Twos complement operation ▪ Take the Boolean complement of each bit of the integer (including the sign bit) ▪ Treating the result as an unsigned binary integer, add 1  The negative of the negative of that number is itself: +18 = 00010010 (twos complement) bitwise complement = 11101101 + 1 11101110 = -18 -18 = 11101110 (twos complement) bitwise complement = 00010001 + 1 00010010 = +18
  • 15. OVERFLOW RULE:  If two numbers are added, and they are both positive or both negative, then overflow occurs if and only if the result has the opposite sign.
  • 16. Negation Special Case 1 0 = 00000000 (twos complement) Bitwise complement = 11111111 Add 1 to LSB + 1 Result 100000000 Overflow is ignored, so: - 0 = 0
  • 17. Negation Special Case 2 -128 = 10000000 (twos complement) Bitwise complement = 01111111 Add 1 to LSB + 1 Result 10000000 So: -(-128) = -128 X Monitor MSB (sign bit) It should change during negation
  • 18. SUBTRACTION RULE: Rules: 1. To subtract one number (subtrahend) from another (minuend) 2. Take the twos complement (negation) of the subtrahend 3. And add it to the minuend.
  • 20. Hardware for Addition and Subtraction Figure 9.6 Block diagram of Hardware for Addition and Subtraction
  • 22. Multiplication  Complex  Work out partial product for each digit  Take care with place value (column)  Add partial product
  • 23. Multiplication Example 1011 Multiplicand (11 dec) x 1101 Multiplier (13 dec) 1011 Partial products 0000x Note: if multiplier bit is 1 copy 1011xx Multiplicand (place value) 1011xxx Otherwise zero 10001111 Product (143 dec) Note: need double length result`
  • 25. Flowchart for Unsigned Binary Multiplication
  • 26. Multiplying Negative Numbers This does not work! Solution 1 ▪ Convert to positive if required ▪ Multiply as above ▪ If signs were different, negate answer Solution 2 ▪ Booth’s algorithm
  • 28. Example of Booth’s Algorithm
  • 32. Example of Restoring Twos Complement Division