SlideShare a Scribd company logo
1 of 26
Introduction to Number Systems
Storyline …
• Different number systems
• Why use different ones?
• Binary / Octal / Hexadecimal
• Conversions
• Negative number representation
• Binary arithmetic
• Overflow / Underflow
Number Systems
Four number system
 Decimal (10)
 Binary (2)
 Octal (8)
 Hexadecimal (16)
 ............
Binary numbers?
• Computers work only on two states
– On
– Off
• Basic memory elements hold only two states
– Zero / One
• Thus a number system with two elements
{0,1}
• A binary digit – bit !
Decimal numbers
1439 = 1 x 103 + 4 x 102 + 3 x 101 + 9 x 100
Thousands Hundreds Tens Ones
• Radix = 10
Binary Decimal
1101 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
= 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1
= 8 + 4 + 0 + 1
(1101)2 = (13)10
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, ….
Decimal Binary
13
6
3
1
0
2
2
2
2
1
0
1
1
(13)10 = (1101)2
MSB
LSB
Octal Decimal
137 = 1 x 82 + 3 x 81 + 7 x 80
= 1 x 64 + 3 x 8 + 7 x 1
= 64 + 24 + 7
(137)8 = (95)10
• Digits used in Octal number system – 0 to 7
Decimal Octal
95
11
1
0
8
8
8
7
3
1
(95)10 = (137)8
MSP
LSP
Hex Decimal
BAD = 11 x 162 + 10 x 161 + 13 x 160
= 11 x 256 + 10 x 16 + 13 x 1
= 2816 + 160 + 13
(BAD)16 = (2989)10
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
Decimal Hex
2989
186
11
0
16
16
16
13
10
11
(2989)10 = (BAD)16
MSP
LSP
Why octal or hex?
• Ease of use and conversion
• Three bits make one octal digit
111 010 110 101
7 2 6 5 => 7265 in octal
• Four bits make one hexadecimal digit
1110 1011 0101
E B 5 => EB5 in hex
4 bits = nibble
Negative numbers
Three representations
• Signed magnitude
• 1’s complement
• 2’s complement
Sign magnitude
• Make MSB represent sign
• Positive = 0
• Negative = 1
• E.g. for a 3 bit set
– “-2”
Sign Bit Bit
1 1 0
MSB LSB
1’s complement
• MSB as in sign magnitude
• Complement all the other bits
• Given a positive number complement all
bits to get negative equivalent
• E.g. for a 3 bit set
– “-2” Sign Bit Bit
1 0 1
0 1 0
2’s complement
• 1’s complement plus one
• E.g. for a 3 bit set
– “-2”
Sign Bit Bit
1 1 0
0 1 0
Decimal
number
Signed
magnitude
2’s complement 1’s complement
3 011 011 011
2 010 010 010
1 001 001 001
0 000 000 000
-0 100 --- 111
-1 101 111 110
-2 110 110 101
-3 111 101 100
-4 100
No matter which scheme is used we get an even set of numbers but we need one less
(odd: as we have a unique zero)
Binary Arithmetic
• Addition / subtraction
• Unsigned
• Signed
– Using negative numbers
Unsigned: Addition
Like normal decimal addition
B
A
The carry out of the MSB is neglected
+ 0 1
0 0 1
1 1 10
0101 (5)
+ 1001 (9)
1110 (14)
Unsigned: Subtraction
Like normal decimal subtraction
B
A
A borrow (shown in red) from the MSB implies a
negative
- 0 1
0 0 11
1 1 0
1001 (9)
- 0101 (5)
0100 (4)
Signed arithmetic
• Use a negative number representation
scheme
• Reduces subtraction to addition
2’s complement
Negative numbers in 2’s complement
001 ( 1)10
101 (-3)10
110 (-2)10
The carry out of the MSB is lost
Overflow / Underflow
• Maximum value N bits can hold : 2n –1
• When addition result is bigger than the biggest
number of bits can hold.
– Overflow
• When addition result is smaller than the smallest
number the bits can hold.
– Underflow
• Addition of a positive and a negative number
cannot give an overflow or underflow.
Overflow example
011 (+3)10
011 (+3)10
110 (+6)10 ????
1’s complement computer interprets it as –1 !!
(+6)10 = (0110)2 requires four bits !
Underflow examples
Two’s complement addition
101 (-3)10
101 (-3)10
Carry 1 010 (-6)10 ????
The computer sees it as +2.
(-6)10 = (1010)2 again requires four bits !

More Related Content

Similar to Arithmetic.ppt

data representation
 data representation data representation
data representationHaroon_007
 
08 Numeral systems
08 Numeral systems08 Numeral systems
08 Numeral systemsmaznabili
 
Standard 9th Number System Power point presentation
Standard 9th Number System Power point presentationStandard 9th Number System Power point presentation
Standard 9th Number System Power point presentationhemangipednekar0812
 
Lecture-2(2): Number System & Conversion
Lecture-2(2): Number System & ConversionLecture-2(2): Number System & Conversion
Lecture-2(2): Number System & ConversionMubashir Ali
 
Digital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdfDigital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdfKannan Kanagaraj
 
09 arithmetic
09 arithmetic09 arithmetic
09 arithmeticargiaggi
 
binary-numbers-system.doc.docx
binary-numbers-system.doc.docxbinary-numbers-system.doc.docx
binary-numbers-system.doc.docxArvindShukla81
 
Number system
Number systemNumber system
Number systemSajib
 
NumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdfNumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdfMarzCasipong1
 
binary-numbers-7-12-2011.pdf
binary-numbers-7-12-2011.pdfbinary-numbers-7-12-2011.pdf
binary-numbers-7-12-2011.pdfkndnewguade
 
Chapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfChapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfTamiratDejene1
 

Similar to Arithmetic.ppt (20)

Cit 1101 lec 02
Cit 1101 lec 02Cit 1101 lec 02
Cit 1101 lec 02
 
Digital Electronics Notes.pdf
Digital Electronics Notes.pdfDigital Electronics Notes.pdf
Digital Electronics Notes.pdf
 
data representation
 data representation data representation
data representation
 
Number System.pptx
Number System.pptxNumber System.pptx
Number System.pptx
 
08 Numeral systems
08 Numeral systems08 Numeral systems
08 Numeral systems
 
Standard 9th Number System Power point presentation
Standard 9th Number System Power point presentationStandard 9th Number System Power point presentation
Standard 9th Number System Power point presentation
 
Lecture-2(2): Number System & Conversion
Lecture-2(2): Number System & ConversionLecture-2(2): Number System & Conversion
Lecture-2(2): Number System & Conversion
 
Digital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdfDigital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdf
 
09 arithmetic
09 arithmetic09 arithmetic
09 arithmetic
 
09 arithmetic 2
09 arithmetic 209 arithmetic 2
09 arithmetic 2
 
09 arithmetic
09 arithmetic09 arithmetic
09 arithmetic
 
Number System.pptx
Number System.pptxNumber System.pptx
Number System.pptx
 
binary-numbers-system.doc.docx
binary-numbers-system.doc.docxbinary-numbers-system.doc.docx
binary-numbers-system.doc.docx
 
Number system
Number systemNumber system
Number system
 
NumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdfNumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdf
 
Binary numbers-7-12-2011
Binary numbers-7-12-2011Binary numbers-7-12-2011
Binary numbers-7-12-2011
 
binary-numbers-7-12-2011.pdf
binary-numbers-7-12-2011.pdfbinary-numbers-7-12-2011.pdf
binary-numbers-7-12-2011.pdf
 
Okkkkk
OkkkkkOkkkkk
Okkkkk
 
Chapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfChapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdf
 
Number Systems.ppt
Number Systems.pptNumber Systems.ppt
Number Systems.ppt
 

More from MarlonMagtibay2

More from MarlonMagtibay2 (15)

informationmanagement-130518152950-phpapp01.pptx
informationmanagement-130518152950-phpapp01.pptxinformationmanagement-130518152950-phpapp01.pptx
informationmanagement-130518152950-phpapp01.pptx
 
chapter8-stack-161018120225.pdf
chapter8-stack-161018120225.pdfchapter8-stack-161018120225.pdf
chapter8-stack-161018120225.pdf
 
arrays-130116232821-phpapp02.pdf
arrays-130116232821-phpapp02.pdfarrays-130116232821-phpapp02.pdf
arrays-130116232821-phpapp02.pdf
 
CS4961-L1.ppt
CS4961-L1.pptCS4961-L1.ppt
CS4961-L1.ppt
 
CS4961-L9.ppt
CS4961-L9.pptCS4961-L9.ppt
CS4961-L9.ppt
 
Data Structure - Stack.pptx
Data Structure - Stack.pptxData Structure - Stack.pptx
Data Structure - Stack.pptx
 
Lecture_Computer_Codes.ppt
Lecture_Computer_Codes.pptLecture_Computer_Codes.ppt
Lecture_Computer_Codes.ppt
 
lecture3_dec_bin_1.ppt
lecture3_dec_bin_1.pptlecture3_dec_bin_1.ppt
lecture3_dec_bin_1.ppt
 
Lec2_NumberSystems.ppt
Lec2_NumberSystems.pptLec2_NumberSystems.ppt
Lec2_NumberSystems.ppt
 
binary-numbers.ppt
binary-numbers.pptbinary-numbers.ppt
binary-numbers.ppt
 
01.NumberSystems.ppt
01.NumberSystems.ppt01.NumberSystems.ppt
01.NumberSystems.ppt
 
lect1.ppt
lect1.pptlect1.ppt
lect1.ppt
 
renewablle energy.ppt
renewablle energy.pptrenewablle energy.ppt
renewablle energy.ppt
 
ch04.ppt
ch04.pptch04.ppt
ch04.ppt
 
lecture01_Introduction.pdf
lecture01_Introduction.pdflecture01_Introduction.pdf
lecture01_Introduction.pdf
 

Recently uploaded

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 

Recently uploaded (20)

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 

Arithmetic.ppt