SlideShare a Scribd company logo
1 of 28
Computer
Arithmetic
Number System
                             Used by Used in
System    Base Symbols       humans? computers?

Decimal    10   0, 1, … 9      Yes       No

Binary     2    0, 1           No       Yes
Octal      8    0, 1, … 7      No        No

Hexa-      16   0, 1, … 9,     No        No
decimal         A, B, … F
Binary?
– Uses only two digits, 0 and 1
– It is base or radix of 2


     In State 0               In state 1
Binary?
• Each digit has a value depending on its
  position:
   102 = (1x21)+(0x20) = 210

   112 = (1x21)+(1x20) = 310

   1002 = (1x22)+ (0x21)+(0x20) = 410
Why Binary ?
• digital
 on" and "off“          digits – 0 and 1

• binary use more storage than decimal

• Easier to handle 2-digits for circuits,
  transistors i.e (1,0) rather then more
Why Binary?
• Recall: we can use numbers to represent
  marital status information:
  • 0 = single
  • 1 = married
  • 2 = divorced
  • 3 = widowed
Binary Addition Rules

Rules:
  0+0        =0
  0+1        =1
  1+0        =1          (just like in decimal)
     1+1     = 210
              = 102 = 0 with 1 to carry

     1+1+1   = 310
              = 112 = 1 with 1 to carry
Decimal Addition Example

                    1) Add 8 + 7 = 15
Add 3758 to 4657:         Write down 5, carry 1

                    2) Add 5 + 5 + 1 = 11
   111                    Write down 1, carry 1
   3758             3) Add 7 + 6 + 1 = 14
 + 4657                   Write down 4, carry 1

   8 415            4) Add 3 + 4 + 1 = 8
                          Write down 8
Decimal Addition Explanation
                                  What just happened?

      111                              1 1 1      (carry)

      3758                             3 7 5 8
                                      +4 6 5 7
    + 4657                            -
                                        8 14 11 15 (sum)
                                           10 10 10 (subtract the base)
                                       8 4 1 5
      8415
So when the sum of a column is equal to or greater than the base, we
subtract the base from the sum, record the difference, and carry one to the
next column to the left.
Binary Addition Example 1
                         Col 1) Add 1 + 0 = 1 Write 1
Example 1: Add
binary 110111 to 11100   Col 2) Add 1 + 0 = Write
                             1
                         Col 3) Add 1 + 1 = 2 (10 in binary)
                                  Write 0, carry 1
                         Col 4) Add 1+ 0 + 1 = 2
                                  Write 0, carry 1
 1 1 1 1
   1 1 0 1 1 1           Col 5) Add 1 + 1 + 1 = 3 (11 in binary)
                                 Write 1, carry 1
 + 0 1 1 1 0 0             Col 6) Add 1 + 1 + 0 = 2
  10 1 00 1 1                       Write 0, carry 1
                          Col 7) Bring down the carried 1
                                   Write 1
Binary Addition Explanation
What is actually       In the first two columns,
happened when we            there were no carries.
carried in binary?     In column 3, we add 1 + 1 = 2
                           Since 2 is equal to the base, subtract
                           the base from the sum and carry 1.
                       In column 4, we also subtract
   1 1   1   1             the base from the sum and carry 1.
     1   1   01 1 1    In column 5, we also subtract
                           the base from the sum and carry 1.
  + 0    1   11 0 0
                       In column 6, we also subtract
     2   3   22             the base from the sum and carry 1.
  - 2    2   22    .    In column 7, we just bring down the
                             carried 1
   1 0    1 0 0 1 1
Binary Addition Verification

You can always check your       Verification
answer by converting the         1101112      5510
figures to decimal, doing the   +0111002          + 2810
addition, and comparing the                         8310
answers.
                                    64 32 16 8 4 2 1
                                     1 0 1 0 0 1 1
      1 1 0 1 1 1                  = 64 + 16 + 2 +1
 +    0 1 1 1 0 0                  = 8310

     1 0 1 0 0 1 1
Binary Addition Example 2

Example 2:            Verification
Add 1111 to 111010.    1110102      5810
                      +0011112         + 1510
                                          7310

 1 1 1 1 1                64 32 16 8 4 2 1
   1 1 1 0 1 0             1 0 0 1 0 0 1

+ 0 0 1 1 1 1            = 64 + 8 +1
                         = 7310
  1 0 0 1 0 0 1
Binary subtraction By
 compliment method
1’S Complement

                   01010011
 Invert All Bits   10101100




                              15
2’S Complement

                   01010011
 Invert All Bits   10101100
                         +1
  Add One          10101101


                              16
Add/Sub : 4 Combinations

                         9                            (-9)
Positive / Positive            Negative / Positive
 Positive Answer       + 5      Negative Answer      + 5
                        14                            -4

                          9                            (-9)
Positive / Negative            Negative / Negative
 Positive Answer
                      + (-5)    Negative Answer      + (-5)
                          4                           - 14
                                                              17
Positive / Positive Combination


                          9      00001001
  Positive / Positive
   Positive Answer      + 5    + 00000101
                         14      00001110
Both Positive Numbers
Use Straight Binary Addition




                                            18
Positive / Negative Combination


                          9      00001001
Positive / Negative
 Positive Answer
                      + (-5)   + 11111011
                          4    1]00000100
1-Positive / 1-Negative
                                 8th Bit = 0 : Answer is Positive
Take 2’s Complement                      Disregard 9th Bit
Of Negative Number (-5)
                                 00000101
                                                               2’s
                                  11111010                 Complement
                                                             Process
                                        +1
                                  11111011                          19
Negative / Positive Combination


                       (-9)         11110111
Positive / Negative
 Negative Answer
                      + 5        + 00000101
                       - 4         11111100
1-Positive / 1-Negative
                                      8th Bit = 1 : Answer is Negative
Take 2’s Complement                Take 2’s Complement to Check Answer
Of Negative Number (-9)
                      11111100        00001001
         2’s                                                     2’s
     Complement       00000011         11110110              Complement
       Process                                                 Process
                            +1               +1
                      00000100         11110111                          20
Negative / Negative Combination

                                                               2’s Complement
                         (-9)      11110111                    Numbers, See
                                                               Conversion Process
Negative / Negative
 Negative Answer
                      + (-5)     + 11111011                    In Previous Slides



                       - 14      1]11110010
2-Negative
Take 2’s Complement Of               8th Bit = 1 : Answer is Negative
                                              Disregard 9th Bit
Both Negative Numbers             Take 2’s Complement to Check Answer

                      11110010
         2’s
     Complement       00001101
       Process              +1
                      00001110                                           21
2’S Complement Quick Method

    Example:        11101100
1) Start at the LSB and write down all zeros moving
to the left.

2) Write down the first “1” you come to.

3) Invert the rest of the bits moving to the left.



                    0 001 0 1 0 0
                                                      22
Binary Subtraction
By borrow method
Binary Subtraction
               Explanation
 In binary, the base unit is 2

 So when you cannot subtract, you borrow from the
  column to the left.
    The amount borrowed is 2.
    The 2 is added to the original column value, so
     you will be able to subtract.
Binary Subtraction
                 Example 1
                           Col 1) Subtract 1 – 0 = 1
Example 1: Subtract        Col 2) Subtract 1 – 0 = 1
binary 11100 from 110011   Col 3) Try to subtract 0 – 1  can’t.
                                       Must borrow 2 from next column.
                                  But next column is 0, so must go to
                                       column after next to borrow.
      2    1                      Add the borrowed 2 to the 0 on the right.
    0 0    2 2                       Now you can borrow from this column
                                     (leaving 1 remaining).
    1 1    0 0 1 1                Add the borrowed 2 to the original 0.
                                        Then subtract 2 – 1 = 1
-     1    1 1 0 0         Col 4) Subtract 1 – 1 = 0
       1 0 1 1 1           Col 5) Try to subtract 0 – 1  can’t.
                                        Must borrow from next column.
                                  Add the borrowed 2 to the remaining 0.
                                           Then subtract 2 – 1 = 1
                           Col 6) Remaining leading 0 can be ignored.
Binary Subtraction
                Verification
                           Verification
                           1100112  5110
Subtract binary
11100 from 110011:     -    111002      - 2810
                                       2310
      2    1
    0 0    2 2             64 32 16 8 4 2 1
                                   1 0 1 1 1
    1 1    0 0 1 1
                        = 16 + 4 + 2 + 1
-     1    1 1 0 0      = 2310

        1 0 1 1 1
Binary Subtraction
              Example 2
                            Verification
Example 2: Subtract         1010012  4110
binary 10100 from 101001   - 101002      - 2010
                                         2110

                              64 32 16 8 4 2 1
    0 2 0 2                           1 0 1 0 1
    1 0 1 0 0 1            = 16 + 4 + 1
                           = 2110
-     1 0 1 0 0
        1 0 1 0 1
Binary Multiplication

More Related Content

What's hot

Naskah Murid Modul 1 Number Bases
Naskah Murid Modul 1 Number BasesNaskah Murid Modul 1 Number Bases
Naskah Murid Modul 1 Number BasesZURAIDA ADAM
 
Math unit7 number system and bases
Math unit7 number system and basesMath unit7 number system and bases
Math unit7 number system and baseseLearningJa
 
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_systemsImran Waris
 
Top schools in delhi ncr
Top schools in delhi ncrTop schools in delhi ncr
Top schools in delhi ncrEdhole.com
 
Binary reference guide csit vn1202
Binary reference guide csit vn1202Binary reference guide csit vn1202
Binary reference guide csit vn1202jrwalker2012
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in indiaEdhole.com
 
Math (F1) Decimal
Math (F1)  DecimalMath (F1)  Decimal
Math (F1) Decimalroszelan
 
Number System | Types of Number System | Binary Number System | Octal Number ...
Number System | Types of Number System | Binary Number System | Octal Number ...Number System | Types of Number System | Binary Number System | Octal Number ...
Number System | Types of Number System | Binary Number System | Octal Number ...Get & Spread Knowledge
 
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"Ra'Fat Al-Msie'deen
 
Number Systems
Number SystemsNumber Systems
Number Systemsstudent
 

What's hot (15)

Naskah Murid Modul 1 Number Bases
Naskah Murid Modul 1 Number BasesNaskah Murid Modul 1 Number Bases
Naskah Murid Modul 1 Number Bases
 
Mba ebooks
Mba ebooksMba ebooks
Mba ebooks
 
Math unit7 number system and bases
Math unit7 number system and basesMath unit7 number system and bases
Math unit7 number system and bases
 
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
 
Top schools in delhi ncr
Top schools in delhi ncrTop schools in delhi ncr
Top schools in delhi ncr
 
Binary reference guide csit vn1202
Binary reference guide csit vn1202Binary reference guide csit vn1202
Binary reference guide csit vn1202
 
Chpater 6
Chpater 6Chpater 6
Chpater 6
 
Bolum1cozumler
Bolum1cozumlerBolum1cozumler
Bolum1cozumler
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Golden ratio
Golden ratioGolden ratio
Golden ratio
 
Math (F1) Decimal
Math (F1)  DecimalMath (F1)  Decimal
Math (F1) Decimal
 
Number System | Types of Number System | Binary Number System | Octal Number ...
Number System | Types of Number System | Binary Number System | Octal Number ...Number System | Types of Number System | Binary Number System | Octal Number ...
Number System | Types of Number System | Binary Number System | Octal Number ...
 
Sistem bilangan
Sistem bilanganSistem bilangan
Sistem bilangan
 
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
 
Number Systems
Number SystemsNumber Systems
Number Systems
 

Viewers also liked

Flegt timber pass en sept 2011
Flegt timber pass en sept 2011Flegt timber pass en sept 2011
Flegt timber pass en sept 2011Ted Wiegman
 
Transformingwiththeipadcamera
TransformingwiththeipadcameraTransformingwiththeipadcamera
TransformingwiththeipadcameraJennifer Gatz
 
File system of windows xp
File system of windows xpFile system of windows xp
File system of windows xpashubhardwaj03
 

Viewers also liked (6)

Questionnaires
QuestionnairesQuestionnaires
Questionnaires
 
Flegt timber pass en sept 2011
Flegt timber pass en sept 2011Flegt timber pass en sept 2011
Flegt timber pass en sept 2011
 
1
11
1
 
Transformingwiththeipadcamera
TransformingwiththeipadcameraTransformingwiththeipadcamera
Transformingwiththeipadcamera
 
MS office shortcuts
MS  office shortcutsMS  office shortcuts
MS office shortcuts
 
File system of windows xp
File system of windows xpFile system of windows xp
File system of windows xp
 

Similar to Computer arthtmetic,,,

Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmeticgavhays
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in indiaEdhole.com
 
Number system
Number systemNumber system
Number systemaviban
 
Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic renatus katundu
 
L3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptxL3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptxHarish257692
 
Data representation for o and a levels 2
Data representation for o and a levels 2Data representation for o and a levels 2
Data representation for o and a levels 2Fari84
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptssuser52a19e
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalUtkirjonUbaydullaev1
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptRAJKUMARP63
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptRabiaAsif31
 
Binary octal
Binary octalBinary octal
Binary octaldrdipo4
 

Similar to Computer arthtmetic,,, (20)

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
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Number system
Number systemNumber system
Number system
 
unit-2_DL.pdf
unit-2_DL.pdfunit-2_DL.pdf
unit-2_DL.pdf
 
Number system
Number systemNumber system
Number system
 
Number system
Number systemNumber system
Number system
 
Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
L3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptxL3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptx
 
Data representation for o and a levels 2
Data representation for o and a levels 2Data representation for o and a levels 2
Data representation for o and a levels 2
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
binary-numbers.ppt
binary-numbers.pptbinary-numbers.ppt
binary-numbers.ppt
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and Hexadecimal
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
Binary octal
Binary octalBinary octal
Binary octal
 
Binary operations
 Binary operations Binary operations
Binary operations
 
3.4
3.43.4
3.4
 

Recently uploaded

MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxheathfieldcps1
 
Poster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfPoster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfAlexander Litvinenko
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...Nguyen Thanh Tu Collection
 
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Sumit Tiwari
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Celine George
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45MysoreMuleSoftMeetup
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the lifeNitinDeodare
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 

Recently uploaded (20)

MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Poster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfPoster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdf
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the life
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 

Computer arthtmetic,,,

  • 2. Number System Used by Used in System Base Symbols humans? computers? Decimal 10 0, 1, … 9 Yes No Binary 2 0, 1 No Yes Octal 8 0, 1, … 7 No No Hexa- 16 0, 1, … 9, No No decimal A, B, … F
  • 3. Binary? – Uses only two digits, 0 and 1 – It is base or radix of 2 In State 0 In state 1
  • 4. Binary? • Each digit has a value depending on its position:  102 = (1x21)+(0x20) = 210  112 = (1x21)+(1x20) = 310  1002 = (1x22)+ (0x21)+(0x20) = 410
  • 5. Why Binary ? • digital on" and "off“ digits – 0 and 1 • binary use more storage than decimal • Easier to handle 2-digits for circuits, transistors i.e (1,0) rather then more
  • 6. Why Binary? • Recall: we can use numbers to represent marital status information: • 0 = single • 1 = married • 2 = divorced • 3 = widowed
  • 7. Binary Addition Rules Rules: 0+0 =0 0+1 =1 1+0 =1 (just like in decimal)  1+1 = 210 = 102 = 0 with 1 to carry  1+1+1 = 310 = 112 = 1 with 1 to carry
  • 8. Decimal Addition Example 1) Add 8 + 7 = 15 Add 3758 to 4657: Write down 5, carry 1 2) Add 5 + 5 + 1 = 11 111 Write down 1, carry 1 3758 3) Add 7 + 6 + 1 = 14 + 4657 Write down 4, carry 1 8 415 4) Add 3 + 4 + 1 = 8 Write down 8
  • 9. Decimal Addition Explanation What just happened? 111 1 1 1 (carry) 3758 3 7 5 8 +4 6 5 7 + 4657 - 8 14 11 15 (sum) 10 10 10 (subtract the base) 8 4 1 5 8415 So when the sum of a column is equal to or greater than the base, we subtract the base from the sum, record the difference, and carry one to the next column to the left.
  • 10. Binary Addition Example 1 Col 1) Add 1 + 0 = 1 Write 1 Example 1: Add binary 110111 to 11100 Col 2) Add 1 + 0 = Write 1 Col 3) Add 1 + 1 = 2 (10 in binary) Write 0, carry 1 Col 4) Add 1+ 0 + 1 = 2 Write 0, carry 1 1 1 1 1 1 1 0 1 1 1 Col 5) Add 1 + 1 + 1 = 3 (11 in binary) Write 1, carry 1 + 0 1 1 1 0 0 Col 6) Add 1 + 1 + 0 = 2 10 1 00 1 1 Write 0, carry 1 Col 7) Bring down the carried 1 Write 1
  • 11. Binary Addition Explanation What is actually In the first two columns, happened when we there were no carries. carried in binary? In column 3, we add 1 + 1 = 2 Since 2 is equal to the base, subtract the base from the sum and carry 1. In column 4, we also subtract 1 1 1 1 the base from the sum and carry 1. 1 1 01 1 1 In column 5, we also subtract the base from the sum and carry 1. + 0 1 11 0 0 In column 6, we also subtract 2 3 22 the base from the sum and carry 1. - 2 2 22 . In column 7, we just bring down the carried 1 1 0 1 0 0 1 1
  • 12. Binary Addition Verification You can always check your Verification answer by converting the 1101112  5510 figures to decimal, doing the +0111002 + 2810 addition, and comparing the 8310 answers. 64 32 16 8 4 2 1 1 0 1 0 0 1 1 1 1 0 1 1 1 = 64 + 16 + 2 +1 + 0 1 1 1 0 0 = 8310 1 0 1 0 0 1 1
  • 13. Binary Addition Example 2 Example 2: Verification Add 1111 to 111010. 1110102  5810 +0011112 + 1510 7310 1 1 1 1 1 64 32 16 8 4 2 1 1 1 1 0 1 0 1 0 0 1 0 0 1 + 0 0 1 1 1 1 = 64 + 8 +1 = 7310 1 0 0 1 0 0 1
  • 14. Binary subtraction By compliment method
  • 15. 1’S Complement 01010011 Invert All Bits 10101100 15
  • 16. 2’S Complement 01010011 Invert All Bits 10101100 +1 Add One 10101101 16
  • 17. Add/Sub : 4 Combinations 9 (-9) Positive / Positive Negative / Positive Positive Answer + 5 Negative Answer + 5 14 -4 9 (-9) Positive / Negative Negative / Negative Positive Answer + (-5) Negative Answer + (-5) 4 - 14 17
  • 18. Positive / Positive Combination 9 00001001 Positive / Positive Positive Answer + 5 + 00000101 14 00001110 Both Positive Numbers Use Straight Binary Addition 18
  • 19. Positive / Negative Combination 9 00001001 Positive / Negative Positive Answer + (-5) + 11111011 4 1]00000100 1-Positive / 1-Negative 8th Bit = 0 : Answer is Positive Take 2’s Complement Disregard 9th Bit Of Negative Number (-5) 00000101 2’s 11111010 Complement Process +1 11111011 19
  • 20. Negative / Positive Combination (-9) 11110111 Positive / Negative Negative Answer + 5 + 00000101 - 4 11111100 1-Positive / 1-Negative 8th Bit = 1 : Answer is Negative Take 2’s Complement Take 2’s Complement to Check Answer Of Negative Number (-9) 11111100 00001001 2’s 2’s Complement 00000011 11110110 Complement Process Process +1 +1 00000100 11110111 20
  • 21. Negative / Negative Combination 2’s Complement (-9) 11110111 Numbers, See Conversion Process Negative / Negative Negative Answer + (-5) + 11111011 In Previous Slides - 14 1]11110010 2-Negative Take 2’s Complement Of 8th Bit = 1 : Answer is Negative Disregard 9th Bit Both Negative Numbers Take 2’s Complement to Check Answer 11110010 2’s Complement 00001101 Process +1 00001110 21
  • 22. 2’S Complement Quick Method Example: 11101100 1) Start at the LSB and write down all zeros moving to the left. 2) Write down the first “1” you come to. 3) Invert the rest of the bits moving to the left. 0 001 0 1 0 0 22
  • 24. Binary Subtraction Explanation  In binary, the base unit is 2  So when you cannot subtract, you borrow from the column to the left.  The amount borrowed is 2.  The 2 is added to the original column value, so you will be able to subtract.
  • 25. Binary Subtraction Example 1 Col 1) Subtract 1 – 0 = 1 Example 1: Subtract Col 2) Subtract 1 – 0 = 1 binary 11100 from 110011 Col 3) Try to subtract 0 – 1  can’t. Must borrow 2 from next column. But next column is 0, so must go to column after next to borrow. 2 1 Add the borrowed 2 to the 0 on the right. 0 0 2 2 Now you can borrow from this column (leaving 1 remaining). 1 1 0 0 1 1 Add the borrowed 2 to the original 0. Then subtract 2 – 1 = 1 - 1 1 1 0 0 Col 4) Subtract 1 – 1 = 0 1 0 1 1 1 Col 5) Try to subtract 0 – 1  can’t. Must borrow from next column. Add the borrowed 2 to the remaining 0. Then subtract 2 – 1 = 1 Col 6) Remaining leading 0 can be ignored.
  • 26. Binary Subtraction Verification Verification 1100112  5110 Subtract binary 11100 from 110011: - 111002 - 2810 2310 2 1 0 0 2 2 64 32 16 8 4 2 1 1 0 1 1 1 1 1 0 0 1 1 = 16 + 4 + 2 + 1 - 1 1 1 0 0 = 2310 1 0 1 1 1
  • 27. Binary Subtraction Example 2 Verification Example 2: Subtract 1010012  4110 binary 10100 from 101001 - 101002 - 2010 2110 64 32 16 8 4 2 1 0 2 0 2 1 0 1 0 1 1 0 1 0 0 1 = 16 + 4 + 1 = 2110 - 1 0 1 0 0 1 0 1 0 1