SlideShare a Scribd company logo
1 of 13
NUMBER REPRESENTATION
& ARITHMETIC OPERATIONS
1
Number Representation
• ICs store circuits that operate on electrical current by either letting
current pass through, or blocking the current
• Every circuit in the computer to be in a state of on or off (1 or 0)
• Computer can store information in binary form
• Why do we have different number systems??
2
Number System
• abcde = a * e3 + b * e2 + c * e1 + d * e0
3
Units in Powers of 2
4
Number System
5
Number Representation
• Sign Magnitude
• 1’s Complement
• 2’s Complement
6
Sign Magnitude
• Add a bit to the front of the numbers to represent the sign
• In 4 bits, 3 = 0011 and –3 = 1011
• In 4 bits, we can store 16 numbers in unsigned magnitude (0000 to 1111, or decimal 0 to
15) but in signed magnitude we can only store 15 numbers (between –7, or 1111, and
+7, 0111), so we lose a number
• Two problems:
• 0 is now represented in two ways: 0000, 1000, so we lose the ability to store an extra
number since we have two 0s
• We cannot do ordinary arithmetic operations using signed magnitude
• we have to “strip” off the sign bit, perform the operation, and insert the sign bit on the new
answer – this requires extra hardware
7
One’s Complement
• An alternative approach to signed magnitude is one’s complement
where the first bit is again a sign bit
• But negative numbers are stored differently from positive numbers
– Positive number stored as usual
– Negative number – all bits are inverted
• 0s become 1s, 1s become 0s
– Example: +19 in 6 bits = 010011, -19 = 101100
• The first bit is not only the sign bit, but also part of the number
– But we still have two ways to represent 0,
000000 and 111111
8
Two’s Complement
• Positive numbers remain the same
• Negative numbers: derived by flipping each bit and then adding 1 to the
result
– +19 in 6 bits = 010011,
– -19 in 6 bits = 101101
• 010011  101100 +1  101101
– To convert back, flip all bits and add 1
• 101101  010010 + 1  010011
– While this is harder, it has two advantages
• Only 1 way to represent 0 (000000) so we can store 1 extra value that we lost when we tried
signed magnitude and one’s complement
• Arithmetic operations do not require “peeling” off the sign bit
9
10
4-bit Two’s Complement
Binary Decimal
0111 7
0110 6
0101 5
0100 4
0011 3
0010 2
0001 1
0000 0
1000 -8
1001 -7
1010 -6
1011 -5
1100 -4
1101 -3
1110 -2
1111 -1
Two’s Complement
Signed & Unsigned Binary Numbers
11
Binary signed integer representations
12
Examples
• Sign Magnitude
Eg: -6, -7, -12, -13, -15
Try 7-7
• Two’s Complement
Eg: -7, -12
• Subtraction
39-25=14
25-39= -14
13

More Related Content

What's hot

Number system....
Number system....Number system....
Number system....mshoaib15
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmeticgavhays
 
Digital electronics- BCD & Decoder
Digital electronics- BCD & DecoderDigital electronics- BCD & Decoder
Digital electronics- BCD & DecoderPritam Shil
 
Classes and objects
Classes and objectsClasses and objects
Classes and objectsAnil Kumar
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)Jay Patel
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Languagesatvirsandhu9
 
L3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptxL3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptxHarish257692
 
Unit-8-Computer-Arithmetic.pdf
Unit-8-Computer-Arithmetic.pdfUnit-8-Computer-Arithmetic.pdf
Unit-8-Computer-Arithmetic.pdfGafryMahmoud
 
Ascii and Unicode (Character Codes)
Ascii and Unicode (Character Codes)Ascii and Unicode (Character Codes)
Ascii and Unicode (Character Codes)Project Student
 
Binary addition.pptx
Binary addition.pptxBinary addition.pptx
Binary addition.pptxPooja Dixit
 
Floating point representation
Floating point representationFloating point representation
Floating point representationmissstevenson01
 
Polymorphism In c++
Polymorphism In c++Polymorphism In c++
Polymorphism In c++Vishesh Jha
 

What's hot (20)

Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Number system....
Number system....Number system....
Number system....
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
Digital electronics- BCD & Decoder
Digital electronics- BCD & DecoderDigital electronics- BCD & Decoder
Digital electronics- BCD & Decoder
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
 
DATA REPRESENTATION
DATA  REPRESENTATIONDATA  REPRESENTATION
DATA REPRESENTATION
 
Dictionary in python
Dictionary in pythonDictionary in python
Dictionary in python
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Language
 
L3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptxL3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptx
 
Binary codes
Binary codesBinary codes
Binary codes
 
Unit-8-Computer-Arithmetic.pdf
Unit-8-Computer-Arithmetic.pdfUnit-8-Computer-Arithmetic.pdf
Unit-8-Computer-Arithmetic.pdf
 
Character set of c
Character set of cCharacter set of c
Character set of c
 
Adder ppt
Adder pptAdder ppt
Adder ppt
 
Ascii and Unicode (Character Codes)
Ascii and Unicode (Character Codes)Ascii and Unicode (Character Codes)
Ascii and Unicode (Character Codes)
 
Binary addition.pptx
Binary addition.pptxBinary addition.pptx
Binary addition.pptx
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
Polymorphism In c++
Polymorphism In c++Polymorphism In c++
Polymorphism In c++
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
 

Similar to Number Representation and Arithmetic Operations.pptx

Similar to Number Representation and Arithmetic Operations.pptx (20)

Arithmetic unit.ppt
Arithmetic unit.pptArithmetic unit.ppt
Arithmetic unit.ppt
 
Alu1
Alu1Alu1
Alu1
 
Counit2
Counit2Counit2
Counit2
 
3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt
 
digitalelectronics.ppt
digitalelectronics.pptdigitalelectronics.ppt
digitalelectronics.ppt
 
09 arithmetic
09 arithmetic09 arithmetic
09 arithmetic
 
09 arithmetic
09 arithmetic09 arithmetic
09 arithmetic
 
09 arithmetic 2
09 arithmetic 209 arithmetic 2
09 arithmetic 2
 
Chapter 02 Data Types
Chapter 02   Data TypesChapter 02   Data Types
Chapter 02 Data Types
 
Arithmetic.ppt
Arithmetic.pptArithmetic.ppt
Arithmetic.ppt
 
lect1.ppt
lect1.pptlect1.ppt
lect1.ppt
 
NumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdfNumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdf
 
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
 
arithmetic
arithmeticarithmetic
arithmetic
 
Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:
 
Chapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfChapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdf
 
09 arithmetic
09 arithmetic09 arithmetic
09 arithmetic
 
chapter 2 part 2.pdf
chapter 2 part 2.pdfchapter 2 part 2.pdf
chapter 2 part 2.pdf
 
09 binary number systems
09   binary number systems09   binary number systems
09 binary number systems
 

Recently uploaded

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 

Recently uploaded (20)

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 

Number Representation and Arithmetic Operations.pptx

  • 2. Number Representation • ICs store circuits that operate on electrical current by either letting current pass through, or blocking the current • Every circuit in the computer to be in a state of on or off (1 or 0) • Computer can store information in binary form • Why do we have different number systems?? 2
  • 3. Number System • abcde = a * e3 + b * e2 + c * e1 + d * e0 3
  • 6. Number Representation • Sign Magnitude • 1’s Complement • 2’s Complement 6
  • 7. Sign Magnitude • Add a bit to the front of the numbers to represent the sign • In 4 bits, 3 = 0011 and –3 = 1011 • In 4 bits, we can store 16 numbers in unsigned magnitude (0000 to 1111, or decimal 0 to 15) but in signed magnitude we can only store 15 numbers (between –7, or 1111, and +7, 0111), so we lose a number • Two problems: • 0 is now represented in two ways: 0000, 1000, so we lose the ability to store an extra number since we have two 0s • We cannot do ordinary arithmetic operations using signed magnitude • we have to “strip” off the sign bit, perform the operation, and insert the sign bit on the new answer – this requires extra hardware 7
  • 8. One’s Complement • An alternative approach to signed magnitude is one’s complement where the first bit is again a sign bit • But negative numbers are stored differently from positive numbers – Positive number stored as usual – Negative number – all bits are inverted • 0s become 1s, 1s become 0s – Example: +19 in 6 bits = 010011, -19 = 101100 • The first bit is not only the sign bit, but also part of the number – But we still have two ways to represent 0, 000000 and 111111 8
  • 9. Two’s Complement • Positive numbers remain the same • Negative numbers: derived by flipping each bit and then adding 1 to the result – +19 in 6 bits = 010011, – -19 in 6 bits = 101101 • 010011  101100 +1  101101 – To convert back, flip all bits and add 1 • 101101  010010 + 1  010011 – While this is harder, it has two advantages • Only 1 way to represent 0 (000000) so we can store 1 extra value that we lost when we tried signed magnitude and one’s complement • Arithmetic operations do not require “peeling” off the sign bit 9
  • 10. 10 4-bit Two’s Complement Binary Decimal 0111 7 0110 6 0101 5 0100 4 0011 3 0010 2 0001 1 0000 0 1000 -8 1001 -7 1010 -6 1011 -5 1100 -4 1101 -3 1110 -2 1111 -1 Two’s Complement
  • 11. Signed & Unsigned Binary Numbers 11
  • 12. Binary signed integer representations 12
  • 13. Examples • Sign Magnitude Eg: -6, -7, -12, -13, -15 Try 7-7 • Two’s Complement Eg: -7, -12 • Subtraction 39-25=14 25-39= -14 13