SlideShare a Scribd company logo
Software Developers
View of Hardware
Binary Arithmetic
Binary Addition
The steps used for a computer to complete
addition are usually greater than a human,

but
their processing speed is far superior.
RULES
0
0
1
1
1
+
+
+
+
+
0
1
0
1
1
=
=
=
=
+
0
1
1
0
1





(With 1 to carry)
= 1 (With 1 to carry)
Binary Addition
EXAMPLE
1
1
0
0
0
1
1
1
+
Binary Addition
EXAMPLE
1
1
0
0
01
1
1
1
+
0
Binary Addition
EXAMPLE
1
1
01 01 1
1
+
0 1
0 0
Binary Addition
EXAMPLE
1
1
01
0
01
1
1
1
+
1 0 0
Binary Addition
EXAMPLE
11 01 01
1
1
1
+
1 0
0 1 0 0
Binary Addition
EXAMPLE
11
1
01
0
01
1
1
1
+
1 0 1 0 0
Binary Addition
CHECKTHEANSWER
9
11
+
20
Activity 1
Perform the following additions in binary.
10110
32010
+ 4010
+ 1810
=
=
=


7610 + 27110

Binary Subtraction
Computers have trouble performing

subtractions
employed:
so the following rule should be
“X – X is
X
the same as
+ -X”
This is where two’s complement is used.

Binary Subtraction
RULES
Convert the number to binary.
Perform two’s complement on the second
number.
Add both numbers together.
2.
3.
4.
Binary Subtraction
EXAMPLE1
Convert 12 - 8 using two’s complement.
Convert to binary
12 = 000011002
3.
8 = 000010002
Perform one’s complement
000010002
111101112
on the 810

Binary Subtraction
EXAMPLE1
Perform two’s complement.
1 1 1 1 0 1 1 12
0 0 0 0 0 0 0 12
2.
+
1 1 1 1 1 0 0 02
Add the two numbers together.
= 1 0 0 0 0 0 1 0 02 (Ignore insignificant
6.
bits)
Binary Subtraction
EXAMPLE2
What happens
the second?
if the first number is larger than
Try 610 - 1010
Binary Subtraction
EXAMPLE2
Convert to binary
6 = 000001102
2.
10 = 000010102
Perform one’s complement
000010102
111101012
on the 1010

Binary Subtraction
EXAMPLE2
Perform two’s complement.
1 1 1 1 0 1 0 12
0 0 0 0 0 0 0 12
2.
+
= 1 1 1 1 0 1 1 02
Binary Subtraction
EXAMPLE2
Add the two numbers together.
0 0 0 0 0 1 1 02
1 1 1 1 0 1 1 02
2.
+
= 1 1 1 1 1 0 02 (Ends with a negative bit)
1
Binary Subtraction
EXAMPLE2
Perform one’s complement
1 1 1 1 1 1 0 02
0 0 0 0 0 0 1 12
Add 1 to the result.
0 0 0 0 0 0 1 12
0 0 0 0 0 0 0 12
on the result
2.
5.
+
= 0 0 0 0 0 1 0 02
Binary Subtraction
EXAMPLE2
We then add the sign bit
0 0 0 0 0 1 0 02
= 1 0 0 0 0 1 0 02
back.
2.
Activity 2
Perform the following subtractions.
22
76
6 -
- 8 =
- 11 =
44 =
3.
4.
5.
Binary Multiplication
Multiplication follows
shift and add.
The rules include:
the general principal of


0
0
1
1
*
*
*
*
0
1
0
1
=
=
=
=
0
0
0
1




0000
00000
Binary Multiplication
EXAMPLE1
Complete 15 * 5 in binary.
Convert to binary
15 = 000011112
3.
5 = 000001012
Ignore any insignificant
11112
zeros.
6.
x
1012
Binary Multiplication
EXAMPLE1
Multiply the first number.
2.
1 1
1
1
0
12
x
1111 x 1 = 1111
2
1 1 1 1
Now this is where the shift and takes place.
7.
1
Binary Multiplication
EXAMPLE1
Shift one place
second digit.
to the left and multiple the
2.
1 1
1
1 12 1111 x 0 = 0000
x
0 1 2
1 1 1 1
0 0 0 0 Shift One Place
0
Binary Multiplication
EXAMPLE1
Shift one place
third digit.
to the left and multiple the
2.
1 1 1
0
12 1111 x 1 = 1111
x
1 1 2
1 1
0 0 0
1 1 1
1 1
1 Shift One Place
0 0
0 0
Binary Multiplication
EXAMPLE1
Add the total of
1 1 1 1
all the steps.
2.
0
1 1
0
1
0
1
0
0
0
0
+
1 0 0 1 0 1 1
Convert back to decimal to check.
8.
Activity 3
Calculate the following
multiplication shift and
using
add.
binary
12
13
97
*
*
*
3 = 1 0 0 1 0 02
5 = 1 0 0 0 0 0 12
20 = 1 1 1 1 0 0 1 0 1 0


02

121 * 67 = 1 1 1 1 1 1 0 1 0 1 0 1 12

Binary Division
Division in binary is similar to long division in
decimal.
It uses what is called a shift and subtract
method.


Binary Division
EXAMPLE1
Complete 575 / 25 using long division.
0
2. 25 575
 Take the first digit of 575 (5) and see if 25
will go into it.
 If it can not put a zero above and take the
next number.
02
2. 25 575
 How many times does 25 go into 57?
TWICE
Binary Division
02
2. 25 575
50
7
 How much is left over?
 57 – (25 * 2) = 7
02
2. 25 575
50
75
 Drop down the next value
Binary Division
75 – (3 * 25) = 0

023
2. 25 575
50
75
 Divide 75 by 25
 Result = 3
023
2. 25 575
50
75
75
0
 Check for remainder
 FINISH!
Binary Division
Complete the following:

25/5

Step 1: Convert both numbers
25 = 1 1 0 0 1
to binary.
5 = 1
Step
1 0 1
0 1
2: Place the numbers accordingly:
1 1 0 0 1
Binary Division
Step 3: Determine if
first bit of dividend.
1 0 1 (5) will fit into the
1 0 1 1 0 0 1
1 0 1(5) will not fit into 1(1)
Step 4: Place a zero above the first bit and try
the next bit.
1 1 0 0
Binary Division
Step 5: Determine if 1 0 1 (5) will fit into the
next two bits of
0
dividend.
1 0 1 0 0 1
1 0 1(5) will not fit into 1 1(3)
Step 6: Place a zero above the second bit and
try the next bit.
1 1 0 0
Binary Division
Step 7: Determine if 1 0 1 (5)
next three bits of dividend.
will fit into the
0 0
1 0 1 0 1
1 0 1(5) will fit into 1 1 0(6)
Step 8: Place a one above the third bit and
times it by the divisor (1 0 1)
1 1 0 0
Binary Division
Step 9: The multiplication of the divisor should
used.
be
placed under the THREE bits you have
0 0 1
1 0 1
A subtraction should take place, however you
cannot subtract in binary. Therefore, the two’s
complement of the 2nd number must be found and
the two numbers added together to get a result.
1 1 0
1 0 1
0 1
Binary Division
Step 10: The two’s complement
0 0 1
of 1 0 1 is 0 1 1
1 0 1
+
0 0 1
1 1 0
0 1 1
0 1
Binary Division
Step 11: Determine if 1 0 1 will fit into the remainder
0 0 1. The answer
next number.
0 0 1
is no so you must bring down the
1 0 1
+
0 0 1 0
1 1 0
0 1 1
0 1
Binary Division
Step 12: 1 01 does not fit into 0 0 1 0. Therefore, a
zero is placed above
is used.
the last bit. And the next number
0 0 1 0
1 0 1
+
0 0 1 0 1
1 1 0
0 1 1
0 1
Binary Division
Step 13: 1 0 1 does fit into 1 0
placed above the final number
1 so therefore, a one is
and the process of shift
and add must be continued.
0 0 1 0 1
1 0 1
+
0 0 0
0 0
+
1 0 1
0 1 1
1 1 0
0 1 1
0 1
Binary Division
Step 14: The final answer is 1 0 1 (5) remainder zero.
Activity 4
Complete the following divisions:

340 / 20
580 / 17


Activity 5
40/4

36/7


More Related Content

Similar to binary arithmetic conversion.pptx

2.1 data represent on cpu
2.1 data represent on cpu2.1 data represent on cpu
2.1 data represent on cpu
Wan Afirah
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
amudhak10
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
amudhak10
 
Alu1
Alu1Alu1
2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt
Sathishkumar.V
 
2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt
MeghadriGhosh4
 
2sComplementArithmetic1 lecture slides ppt
2sComplementArithmetic1 lecture slides ppt2sComplementArithmetic1 lecture slides ppt
2sComplementArithmetic1 lecture slides ppt
nashitahalwaz95
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.ppt
skatiarrahaman
 
Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1
อภิเษก หงษ์วิทยากร
 
Arithmetic for Computers
Arithmetic for ComputersArithmetic for Computers
Arithmetic for Computers
MD. ABU TALHA
 
Digital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsDigital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systems
Imran Waris
 
Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic
renatus katundu
 
ARITHMETIC FOR COMPUTERS
ARITHMETIC FOR COMPUTERS	  ARITHMETIC FOR COMPUTERS
ARITHMETIC FOR COMPUTERS
Amirthavalli Senthil
 
Top schools in delhi ncr
Top schools in delhi ncrTop schools in delhi ncr
Top schools in delhi ncr
Edhole.com
 
Top schools in delhi ncr
Top schools in delhi ncrTop schools in delhi ncr
Top schools in delhi ncr
Edhole.com
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
sulekhasaxena2
 
Binary number system
Binary number systemBinary number system
Binary number system
Nadeem Uddin
 
CA Unit ii
CA Unit iiCA Unit ii
CA Unit ii
AmirthavalliR
 
tCh10.ppt
tCh10.ppttCh10.ppt
3810-08.ppt
3810-08.ppt3810-08.ppt
3810-08.ppt
SrinivasanCSE
 

Similar to binary arithmetic conversion.pptx (20)

2.1 data represent on cpu
2.1 data represent on cpu2.1 data represent on cpu
2.1 data represent on cpu
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
Alu1
Alu1Alu1
Alu1
 
2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt
 
2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt
 
2sComplementArithmetic1 lecture slides ppt
2sComplementArithmetic1 lecture slides ppt2sComplementArithmetic1 lecture slides ppt
2sComplementArithmetic1 lecture slides ppt
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.ppt
 
Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1
 
Arithmetic for Computers
Arithmetic for ComputersArithmetic for Computers
Arithmetic for Computers
 
Digital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsDigital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systems
 
Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic
 
ARITHMETIC FOR COMPUTERS
ARITHMETIC FOR COMPUTERS	  ARITHMETIC FOR COMPUTERS
ARITHMETIC FOR COMPUTERS
 
Top schools in delhi ncr
Top schools in delhi ncrTop schools in delhi ncr
Top schools in delhi ncr
 
Top schools in delhi ncr
Top schools in delhi ncrTop schools in delhi ncr
Top schools in delhi ncr
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
 
Binary number system
Binary number systemBinary number system
Binary number system
 
CA Unit ii
CA Unit iiCA Unit ii
CA Unit ii
 
tCh10.ppt
tCh10.ppttCh10.ppt
tCh10.ppt
 
3810-08.ppt
3810-08.ppt3810-08.ppt
3810-08.ppt
 

Recently uploaded

5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
Ratnakar Mikkili
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 

Recently uploaded (20)

5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 

binary arithmetic conversion.pptx