SlideShare a Scribd company logo
Lesson 1
Basic Theory of Information
Number System
 Number
    It is a symbol representing a unit or quantity.
 Number     System
    Defines a set of symbols used to represent
     quantity
 Radix
    The base or radix of number system determines
     how many numerical digits the number system
     uses.
Types of Number System
 Decimal System
 Binary Number System

 Octal Number System

 Hexadecimal Number System
Decimal Number System
 Ingenious   method of expressing all numbers
  by means of tens symbols originated from
  India. It is widely used and is based on the
  ten fingers of a human being.
 It makes use of ten numeric symbols
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Inherent Value and Positional Value

   The inherent value of a symbol is the value of that
    symbol standing alone.
       Example 6 in number 256, 165, 698
         The symbol is related to the quantity six, even if it is used in
          different number positions
   The positional value of a numeric symbol is
    directly related to the base of a system.
       In the case of decimal system, each position has a
        value of 10 times greater that the position to its right.
        Example: 423, the symbol 3 represents the ones (units), the
        symbol 2 represents the tens position (10 x 1), and the symbol
        4 represents the hundreds position (10 x 10). In other words,
        each symbol move to the left represents an increase in the
        value of the position by a factor of ten.
Inherent and Positional Value cont.

2539 = 2X1000 + 5X100 + 3X10 + 9X1
     = 2X103 + 5X102 + 3X101 + 9 x100

This means that positional value of symbol 2 is
  1000 or using the base 10 it is 103
Binary Number System
 Uses   only two numeric symbols 1 and 0
    Under the binary system, each position has a
     value 2 times greater than the position to the
     right.
Octal Number System
 Octalnumber system is using 8 digits to
 represent numbers. The highest value = 7.
 Each column represents a power of 8. Octal
 numbers are represented with the suffix 8.
Hexadecimal Number System
 Provides  another convenient and simple
  method for expressing values represented by
  binary numerals.
 It uses a base, or radix, of 16 and the place
  values are the powers of 16.
Decimal   Binary   Hexadecimal   Decimal   Binary   Hexadecimal


    0       0000          0           8      1000         8

    1       0001          1           9      1001         9

    2       0010          2           10     1010         A

    3       0011          3           11     1011         B

    4       0100          4           12     1100         C

    5       0101          5           13     1101         D

    6       0110          6           14     1110         E

    7       0111          7           15     1111         F
Radix Conversion
 The  process of converting a base to another.
 To convert a decimal number to any other
  number system, divide the decimal number
  by the base of the destination number
  system. Repeat the process until the quotient
  becomes zero. And note down the
  remainders in the reverse order.
 To convert from any other number system to
  decimal, take the positional value, multiply by
  the digit and add.
Radix Conversion
Radix Conversion
Decimal to Binary Conversion
of Fractions
 Division      – Multiplication Method
     Steps to be followed
         Multiply the decimal fraction by 2 and noting the
          integral part of the product
         Continue to multiply by 2 as long as the resulting
          product is not equal to zero.
         When the obtained product is equal to zero, the binary
          of the number consists of the integral part listed from
          top to bottom in the order they were recorded.
 Example 1: Convert 0.375 to its binary
 equivalent

       Multiplication     Product         Integral part
            0.375 x 2          0.75              0
            0.75 x 2            1.5              1
             0.5 x 2            1.0              1


               0.37510 is equivalent to 0.0112
Exercises
 Convertthe following decimal numbers into
 binary and hexadecimal numbers:
 1.   128
 2.   207
 Convertthe following binary numbers into
 decimal and hexadecimal numbers:
 1.     11111000
 2.      1110110
Binary Arithmetic
 Addition

 Subtraction

 Multiplication

 Division
Binary Addition
1 + 1 = 0 plus a carry of 1
0 + 1 = 1

1 + 0 = 1

0 + 0 = 0
Binary Subtraction
0  –0=0
1 – 0 = 1

1 – 1 = 0

 0 – 1 = 1 with borrow of 1
Binary Multiplication
0  x0=0
0 x 1 = 0

1 x 0 = 0

 1 x 1 =1
Data Representation
 Data on digital computers is represented as a
  sequence of 0s and 1s. This includes
  numeric data, text, executable files, images,
  audio, and video.
 Data can be represented using 2n

 Numeric representation
     Fixed point
     Floating point
 Non    numeric representation
Fixed Point
 Integers  are whole numbers or fixed-point
  numbers with the radix point fixed after the
  least-significant bit.
 Computers use a fixed number of bits to
  represent an integer. The commonly-used
  bit-lengths for integers are 8-bit, 16-bit, 32-bit
  or 64-bit.
 Two representation
Fixed Point: Two
Representation Schemes
 Unsigned Magnitude
 Signed Magnitude

 One’s complement

 Two’s complement
Unsigned magnitude
   Unsigned integers can represent zero and positive
    integers, but not negative integers.
   Example 1: Suppose that n=8 and the binary pattern
    is 0100 0001, the value of this unsigned integer is
    1×2^0 + 1×2^6 = 65.
   Example 2: Suppose that n=16 and the binary
    pattern is 0001 0000 0000 1000, the value of this
    unsigned integer is 1×2^3 + 1×2^12 = 4104.
   An n-bit pattern can represent 2^n distinct integers.
   An n-bit unsigned integer can represent integers
    from 0 to (2^n)-1
Signed magnitude
 The  most-significant bit (msb) is the sign bit,
  with value of 0 representing positive integer
  and 1 representing negative integer.
 The remaining n-1 bits represents the
  magnitude (absolute value) of the integer.
  The absolute value of the integer is
  interpreted as "the magnitude of the (n-1)-bit
  binary pattern".
Signed magnitude
 Example   1: Suppose that n=8 and the binary
  representation is 0 100 0001.
    Sign bit is 0 ⇒ positive
    Absolute value is 100 0001 = 65
    Hence, the integer is +65
 Example 2: Suppose that n=8 and the binary
  representation is 1 000 0001.
    Sign bit is 1 ⇒ negative
    Absolute value is 000 0001 = 1
    Hence, the integer is -1
Signed magnitude
 Example   3: Suppose that n=8 and the binary
  representation is 0 000 0000.
    Sign bit is 0 ⇒ positive
    Absolute value is 000 0000 = 0
    Hence, the integer is +0
 Example 4: Suppose that n=8 and the binary
  representation is 1 000 0000.
    Sign bit is 1 ⇒ negative
    Absolute value is 000 0000B = 0
    Hence, the integer is -0
Lesson 1   basic theory of information
Drawbacks
 Thedrawbacks of sign-magnitude
 representation are:
    There are two representations (0000 0000B and
     1000 0000B) for the number zero, which could
     lead to inefficiency and confusion.
    Positive and negative integers need to be
     processed separately.
One’s Complement
 The most significant bit (msb) is the sign bit, with
  value of 0 representing positive integers and 1
  representing negative integers.
 The remaining n-1 bits represents the magnitude
  of the integer, as follows:
       for positive integers, the absolute value of the integer
        is equal to "the magnitude of the (n-1)-bit binary
        pattern".
       for negative integers, the absolute value of the integer
        is equal to "the magnitude of the complement
        (inverse) of the (n-1)-bit binary pattern" (hence called
        1's complement).
One’s complement
 Example   1: Suppose that n=8 and the binary
  representation 0 100 0001.
    Sign bit is 0 ⇒ positive
    Absolute value is 100 0001 = 65
    Hence, the integer is +65
 Example 2: Suppose that n=8 and the binary
  representation 1 000 0001.
    Sign bit is 1 ⇒ negative
    Absolute value is the complement of 000
  0001B, i.e., 111 1110B = 126
    Hence, the integer is -126
Lesson 1   basic theory of information
Two’s complement
 Again, the most significant bit (msb) is the sign
  bit, with value of 0 representing positive integers
  and 1 representing negative integers.
 The remaining n-1 bits represents the magnitude
  of the integer, as follows:
       for positive integers, the absolute value of the integer
        is equal to "the magnitude of the (n-1)-bit binary
        pattern".
       for negative integers, the absolute value of the integer
        is equal to "the magnitude of the complement of the
        (n-1)-bit binary pattern plus one" (hence called 2's
        complement).
Two’s complement
 Example   1: Suppose that n=8 and the binary
  representation 0 000 0000.
    Sign bit is 0 ⇒ positive
    Absolute value is 000 0000 = 0
    Hence, the integer is +0
 Example 2: Suppose that n=8 and the binary
  representation 1 111 1111.
    Sign bit is 1 ⇒ negative
    Absolute value is the complement of 111
  1111B plus 1, i.e., 000 0000 + 1 = 1
    Hence, the integer is -1
Lesson 1   basic theory of information
Floating point representation
A     real number is represented in exponential
     form (a = +- m x re)
1 bit           8 bits             23 bits (single precision)

 0            10000100            11010000000000000000000

Sign           Exponent                    Mantissa




                          Radix
                          point
IEEE Floating-Point Standard
754
COMPLEMENTS
    Complements are used in digital computers
     for simplifying the subtraction operation and
     for logical manipulations
    2 types for each base-r system
    1)   r’s complement (Radix complement)
    2)   (r-1)’s complement (Diminished radix
         Complement)
Radix Complement
 Referred  to as r’s complement
 The r’s complement of N is obtained as (rn)-N
  where
           r = base or radix
           n = number of digits
           N = number
Example
   Give the 10’s complement for the following number
        a. 583978
        b. 5498

Solution:
        a. N = 583978
                n=6
                106 - 583978
                1,000,000 – 583978 = 436022
        b. N = 5498
                n=4
                104 - 5498
                10, 000 – 5498 = 4502
Diminished Radix Complements
 Referred  to as the (r-1)s complement
 The (r-1)s complement of N is obtained as (rn-
  1)-N where

             r = base or radix
             n = number of digits
             N = number

Therefore 9’s complement of N is (10n-1)- N
Example
    Give the (r-1)’s complement for the following
     number if n=6
a.   567894
b.   012598
Solution
Using the formula (rn-1)-N
     if n = 6
        r = 10
     then 106 = 1, 000, 000
          rn-1= 1, 000, 000 = 999, 999
 A.) N = 567894
           999,999 – 567894 = 432105
      Therefore, the 9’s complement of 567894
        is 432105.
 B.) N = 012598

           999,999 – 012598 = 987401
      Therefore, the 9’s complement of 012598
        is 987401.
Diminished Radix Complement
 Inthe binary number system r=2 then r-1 = 1
  so the 1’s complement of N is (2n-1)-N
 When a binary digit is subtracted from 1, the
  only possibilities are 1-0=1 or 1-1=0

Therefore, 1’s complement of a binary numeral
  is formed by changing 1’s to 0’s and 0’s to
  1’s.
Example
 Compute for the 1’s complement of each of the
  following binary numbers
       a. 1001011
       b. 010110101
Solution:
       a. N=1001011
  The 1’s complement of 1001011 is 0110100
       b. N=010110101
  The 1’s complement of 010110101 is 101001010
Subtraction with Complements
   The subtraction of two n-digit unsigned numbers M
    – N in base r can be done as follows:
     1. Add the minuend M to the r’s complement of
      the subtrahend N.
     If the M >= N, the sum will produce an end carry,
      rn, which is discarded; what is left is the result M –
      N
     If M < N, the sum does not produce an end carry
      ans is equal to rn – (N – M), which is the r’s
      complement of (N – M). To obtain the answer,
      take the r’s complement of the sum and place a
      negative sign in front.
 Using   10’s complement, subtract 72532 –
 3250.
                         M    =      72532
     10’s complement of N     =   + 96750
                      Sum     =     169282
      Discard end carry 105   =   - 100000
                   Answer     =      69282
 Using
      10’s complement, subtract 3250 –
 72532.
                         M      =     03250
     10’s complement of N       = + 27468
                      Sum       =     30718
      There is no end carry.
                   Answer       =    -69282
                     Get the 10’s complement of 30718.
 Using9’s complement, subtract 89 – 23 and
 98 – 87.
Exercise
 Giventwo binary numbers X = 1010100 and
 Y = 1000011, perform the subtraction (a) X –
 Y and (b) Y – X using 2’s complements and
 1’s complement.
Binary Codes
Decimal Digit   (BCD)   Excess-3
                8421
        0       0000    0011
        1       0001    0100
        2       0010    0101       In a digital system,
        3       0011    0110       it may sometimes
                                   represent a binary
        4       0100    0111
                                   number, other
        5       0101    1000       times some other
        6       0110    1001       discrete quantity of
                                   information
        7       0111    1010
        8       1000    1011
        9       1001    1100
Non Numerical
Representations
 Itrefers to a representation of data other than
  numerical values. It refers to the
  representation of a character, sound or
  image.
Standardizations of Character
Codes
Codename        Description
EBCDIC          Computer code defined by IBM for
                general purpose computers. 8 bits
                represent one character.
ASCII           7 bit code established by ANSI
                (American National Standards
                Institute). Used in PC’s.
ISO Code        ISO646 published as a
                recommendation by the International
                Organization for Standardization
                (ISO), based on ASCII
                7 bit code for information exchange
Unicode         An industry standard allowing
                computers to consistently represent
                characters used in most of the
                countries. Every character is
                represented with 2 bytes.
Image and Sound
  Representations
Still Images      GIF          Format to save graphics, 256 colors
                               displayable

                  JPEG         Compression format for color still
                               images

Moving Pictures   Compression format for color moving pictures
                  MPEG-1       Data stored mainly on CD ROM
                  MPEG-2       Stored images like vide; real time
                               images

                  MPEG-4       Standardization for mobile terminals
Sound             PCM
                  MIDI         Interface to connect a musical
                               instrument with a computer.
Operations and Accuracy
 Shift   operations
     It is the operation of shifting a bit string to the right
      or left.

                     Arithmetic Shift         Logical Shift
             Left    Arithmetic Left Shift    Logical left shift
             Right   Arithmetic Right Shift   Logical Right Shift
Arithmetic Shift
Arithmetic Shift is an operation of shifting a bit string,
  except for the sign bit.
Example : Shift bits by 1
           ALS                              ARS
                                        Sign bit    overflow
           overflow


           11111010                         11111010
Sign bit
           11110100                         11111101

                Insert a zero in the vacated spot
Logical Shift
    It shifts a bit string and inserts “0” in places made
     empty by the shift.
    Perform a logical left shift. Shift by 1 bit.
        01111010
    Perform a logical right shift. Shift by 1 bit.
        10011001
Exercise
 Perform  arithmetic right and logical right
 shifts by 3 bits on the 8th binary number
 11001100.

More Related Content

PPTX
Inter Organizational e-commerce
PPT
Selection sort Mechanism and implementation
DOCX
2's complement
PPT
Number system
PPTX
05 organization & business ethics
PPTX
Flagsregistor
PPT
Binary number systems
Inter Organizational e-commerce
Selection sort Mechanism and implementation
2's complement
Number system
05 organization & business ethics
Flagsregistor
Binary number systems

What's hot (9)

PPT
1sand2scomplement r004
PDF
Business Ethics
PPTX
Professional and Ethical, Issues and Responsibilities
PDF
Octal and Hexadecimal Numbering Systems
PPTX
Electronic Data Interchange & Internet
PPT
Hexadecimal
PPTX
data representation
DOCX
questions related to E-Commerce
PPTX
Ethics and culture
1sand2scomplement r004
Business Ethics
Professional and Ethical, Issues and Responsibilities
Octal and Hexadecimal Numbering Systems
Electronic Data Interchange & Internet
Hexadecimal
data representation
questions related to E-Commerce
Ethics and culture
Ad

Viewers also liked (20)

PPTX
Johnny english
PDF
기획회의 롤링다이스
PPTX
Storyboard (Draft)
PDF
Tablas de diseño de acero en compresion
PPTX
PPTX
Content Strategy: WordCamp Buffalo 2012
PPT
The purdygreenteam 10.19.12
PPTX
WordPress Accessibility - WordCamp Buffalo 2016
PDF
Prezentacja ogólna2.0
PPTX
Selfish Accessibility: WordCamp Toronto 2014
PDF
Elia (februari)
PPTX
מצגת שלג Crm שלמה
PPT
Menopauza
PDF
Perl beginners#6 LT
PPTX
How To Apply for Pick.Click.Give. in 2016 - Powerpoint
PPTX
Fringe Accessibility: A11y Camp Toronto 2015
PPTX
The Unwebinar
PPTX
Fringe Accessibility: ID24 for GAAD
PPTX
библиотека. взгляд из будущего
PDF
Scenariusz
Johnny english
기획회의 롤링다이스
Storyboard (Draft)
Tablas de diseño de acero en compresion
Content Strategy: WordCamp Buffalo 2012
The purdygreenteam 10.19.12
WordPress Accessibility - WordCamp Buffalo 2016
Prezentacja ogólna2.0
Selfish Accessibility: WordCamp Toronto 2014
Elia (februari)
מצגת שלג Crm שלמה
Menopauza
Perl beginners#6 LT
How To Apply for Pick.Click.Give. in 2016 - Powerpoint
Fringe Accessibility: A11y Camp Toronto 2015
The Unwebinar
Fringe Accessibility: ID24 for GAAD
библиотека. взгляд из будущего
Scenariusz
Ad

Similar to Lesson 1 basic theory of information (20)

PDF
Finite word length effects
PPTX
Digital Systems.pptx
PPTX
PPT_Module_1.pptx
PPT
1. basic theories of information
PPTX
Chapter_Two.pptx data representation in computer
PPT
Basic Digital_Systems_and_Binary_Numbers Sample.ppt
PPT
Number system and codes
PPT
Number Systems.ppt
PPT
PPT
Chapter 02 Data Types
PPTX
EC8392 -DIGITAL ELECTRONICS -basics
PPT
Number_System and Boolean Algebra in Digital System Design
PPTX
Chapter 1: Binary System
PPTX
1.Digital Electronics overview & Number Systems.pptx
PPTX
UNIT 4 -Data Representation.pptxfghfghhggh
PPT
3.Fixed-Floating Point.ppt
PPT
IS 139 Lecture 4 - 2015
PPT
IS 139 Lecture 4
PPT
Ch02_4web456489478465165489445156568.ppt
Finite word length effects
Digital Systems.pptx
PPT_Module_1.pptx
1. basic theories of information
Chapter_Two.pptx data representation in computer
Basic Digital_Systems_and_Binary_Numbers Sample.ppt
Number system and codes
Number Systems.ppt
Chapter 02 Data Types
EC8392 -DIGITAL ELECTRONICS -basics
Number_System and Boolean Algebra in Digital System Design
Chapter 1: Binary System
1.Digital Electronics overview & Number Systems.pptx
UNIT 4 -Data Representation.pptxfghfghhggh
3.Fixed-Floating Point.ppt
IS 139 Lecture 4 - 2015
IS 139 Lecture 4
Ch02_4web456489478465165489445156568.ppt

Recently uploaded (20)

PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
master seminar digital applications in india
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
Computing-Curriculum for Schools in Ghana
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Pharma ospi slides which help in ospi learning
O7-L3 Supply Chain Operations - ICLT Program
VCE English Exam - Section C Student Revision Booklet
102 student loan defaulters named and shamed – Is someone you know on the list?
STATICS OF THE RIGID BODIES Hibbelers.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Anesthesia in Laparoscopic Surgery in India
master seminar digital applications in india
Module 4: Burden of Disease Tutorial Slides S2 2025
PPH.pptx obstetrics and gynecology in nursing
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
RMMM.pdf make it easy to upload and study
Computing-Curriculum for Schools in Ghana
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
human mycosis Human fungal infections are called human mycosis..pptx
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf

Lesson 1 basic theory of information

  • 1. Lesson 1 Basic Theory of Information
  • 2. Number System  Number  It is a symbol representing a unit or quantity.  Number System  Defines a set of symbols used to represent quantity  Radix  The base or radix of number system determines how many numerical digits the number system uses.
  • 3. Types of Number System  Decimal System  Binary Number System  Octal Number System  Hexadecimal Number System
  • 4. Decimal Number System  Ingenious method of expressing all numbers by means of tens symbols originated from India. It is widely used and is based on the ten fingers of a human being.  It makes use of ten numeric symbols  0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • 5. Inherent Value and Positional Value  The inherent value of a symbol is the value of that symbol standing alone.  Example 6 in number 256, 165, 698  The symbol is related to the quantity six, even if it is used in different number positions  The positional value of a numeric symbol is directly related to the base of a system.  In the case of decimal system, each position has a value of 10 times greater that the position to its right. Example: 423, the symbol 3 represents the ones (units), the symbol 2 represents the tens position (10 x 1), and the symbol 4 represents the hundreds position (10 x 10). In other words, each symbol move to the left represents an increase in the value of the position by a factor of ten.
  • 6. Inherent and Positional Value cont. 2539 = 2X1000 + 5X100 + 3X10 + 9X1 = 2X103 + 5X102 + 3X101 + 9 x100 This means that positional value of symbol 2 is 1000 or using the base 10 it is 103
  • 7. Binary Number System  Uses only two numeric symbols 1 and 0  Under the binary system, each position has a value 2 times greater than the position to the right.
  • 8. Octal Number System  Octalnumber system is using 8 digits to represent numbers. The highest value = 7. Each column represents a power of 8. Octal numbers are represented with the suffix 8.
  • 9. Hexadecimal Number System  Provides another convenient and simple method for expressing values represented by binary numerals.  It uses a base, or radix, of 16 and the place values are the powers of 16.
  • 10. Decimal Binary Hexadecimal Decimal Binary Hexadecimal 0 0000 0 8 1000 8 1 0001 1 9 1001 9 2 0010 2 10 1010 A 3 0011 3 11 1011 B 4 0100 4 12 1100 C 5 0101 5 13 1101 D 6 0110 6 14 1110 E 7 0111 7 15 1111 F
  • 11. Radix Conversion  The process of converting a base to another.  To convert a decimal number to any other number system, divide the decimal number by the base of the destination number system. Repeat the process until the quotient becomes zero. And note down the remainders in the reverse order.  To convert from any other number system to decimal, take the positional value, multiply by the digit and add.
  • 14. Decimal to Binary Conversion of Fractions  Division – Multiplication Method  Steps to be followed  Multiply the decimal fraction by 2 and noting the integral part of the product  Continue to multiply by 2 as long as the resulting product is not equal to zero.  When the obtained product is equal to zero, the binary of the number consists of the integral part listed from top to bottom in the order they were recorded.
  • 15.  Example 1: Convert 0.375 to its binary equivalent Multiplication Product Integral part 0.375 x 2 0.75 0 0.75 x 2 1.5 1 0.5 x 2 1.0 1 0.37510 is equivalent to 0.0112
  • 16. Exercises  Convertthe following decimal numbers into binary and hexadecimal numbers: 1. 128 2. 207  Convertthe following binary numbers into decimal and hexadecimal numbers: 1. 11111000 2. 1110110
  • 17. Binary Arithmetic  Addition  Subtraction  Multiplication  Division
  • 18. Binary Addition 1 + 1 = 0 plus a carry of 1 0 + 1 = 1 1 + 0 = 1 0 + 0 = 0
  • 19. Binary Subtraction 0 –0=0 1 – 0 = 1 1 – 1 = 0  0 – 1 = 1 with borrow of 1
  • 20. Binary Multiplication 0 x0=0 0 x 1 = 0 1 x 0 = 0  1 x 1 =1
  • 21. Data Representation  Data on digital computers is represented as a sequence of 0s and 1s. This includes numeric data, text, executable files, images, audio, and video.  Data can be represented using 2n  Numeric representation  Fixed point  Floating point  Non numeric representation
  • 22. Fixed Point  Integers are whole numbers or fixed-point numbers with the radix point fixed after the least-significant bit.  Computers use a fixed number of bits to represent an integer. The commonly-used bit-lengths for integers are 8-bit, 16-bit, 32-bit or 64-bit.  Two representation
  • 23. Fixed Point: Two Representation Schemes  Unsigned Magnitude  Signed Magnitude  One’s complement  Two’s complement
  • 24. Unsigned magnitude  Unsigned integers can represent zero and positive integers, but not negative integers.  Example 1: Suppose that n=8 and the binary pattern is 0100 0001, the value of this unsigned integer is 1×2^0 + 1×2^6 = 65.  Example 2: Suppose that n=16 and the binary pattern is 0001 0000 0000 1000, the value of this unsigned integer is 1×2^3 + 1×2^12 = 4104.  An n-bit pattern can represent 2^n distinct integers.  An n-bit unsigned integer can represent integers from 0 to (2^n)-1
  • 25. Signed magnitude  The most-significant bit (msb) is the sign bit, with value of 0 representing positive integer and 1 representing negative integer.  The remaining n-1 bits represents the magnitude (absolute value) of the integer. The absolute value of the integer is interpreted as "the magnitude of the (n-1)-bit binary pattern".
  • 26. Signed magnitude  Example 1: Suppose that n=8 and the binary representation is 0 100 0001. Sign bit is 0 ⇒ positive Absolute value is 100 0001 = 65 Hence, the integer is +65  Example 2: Suppose that n=8 and the binary representation is 1 000 0001. Sign bit is 1 ⇒ negative Absolute value is 000 0001 = 1 Hence, the integer is -1
  • 27. Signed magnitude  Example 3: Suppose that n=8 and the binary representation is 0 000 0000. Sign bit is 0 ⇒ positive Absolute value is 000 0000 = 0 Hence, the integer is +0  Example 4: Suppose that n=8 and the binary representation is 1 000 0000. Sign bit is 1 ⇒ negative Absolute value is 000 0000B = 0 Hence, the integer is -0
  • 29. Drawbacks  Thedrawbacks of sign-magnitude representation are:  There are two representations (0000 0000B and 1000 0000B) for the number zero, which could lead to inefficiency and confusion.  Positive and negative integers need to be processed separately.
  • 30. One’s Complement  The most significant bit (msb) is the sign bit, with value of 0 representing positive integers and 1 representing negative integers.  The remaining n-1 bits represents the magnitude of the integer, as follows:  for positive integers, the absolute value of the integer is equal to "the magnitude of the (n-1)-bit binary pattern".  for negative integers, the absolute value of the integer is equal to "the magnitude of the complement (inverse) of the (n-1)-bit binary pattern" (hence called 1's complement).
  • 31. One’s complement  Example 1: Suppose that n=8 and the binary representation 0 100 0001. Sign bit is 0 ⇒ positive Absolute value is 100 0001 = 65 Hence, the integer is +65  Example 2: Suppose that n=8 and the binary representation 1 000 0001. Sign bit is 1 ⇒ negative Absolute value is the complement of 000 0001B, i.e., 111 1110B = 126 Hence, the integer is -126
  • 33. Two’s complement  Again, the most significant bit (msb) is the sign bit, with value of 0 representing positive integers and 1 representing negative integers.  The remaining n-1 bits represents the magnitude of the integer, as follows:  for positive integers, the absolute value of the integer is equal to "the magnitude of the (n-1)-bit binary pattern".  for negative integers, the absolute value of the integer is equal to "the magnitude of the complement of the (n-1)-bit binary pattern plus one" (hence called 2's complement).
  • 34. Two’s complement  Example 1: Suppose that n=8 and the binary representation 0 000 0000. Sign bit is 0 ⇒ positive Absolute value is 000 0000 = 0 Hence, the integer is +0  Example 2: Suppose that n=8 and the binary representation 1 111 1111. Sign bit is 1 ⇒ negative Absolute value is the complement of 111 1111B plus 1, i.e., 000 0000 + 1 = 1 Hence, the integer is -1
  • 36. Floating point representation A real number is represented in exponential form (a = +- m x re) 1 bit 8 bits 23 bits (single precision) 0 10000100 11010000000000000000000 Sign Exponent Mantissa Radix point
  • 38. COMPLEMENTS  Complements are used in digital computers for simplifying the subtraction operation and for logical manipulations  2 types for each base-r system 1) r’s complement (Radix complement) 2) (r-1)’s complement (Diminished radix Complement)
  • 39. Radix Complement  Referred to as r’s complement  The r’s complement of N is obtained as (rn)-N where r = base or radix n = number of digits N = number
  • 40. Example  Give the 10’s complement for the following number a. 583978 b. 5498 Solution: a. N = 583978 n=6 106 - 583978 1,000,000 – 583978 = 436022 b. N = 5498 n=4 104 - 5498 10, 000 – 5498 = 4502
  • 41. Diminished Radix Complements  Referred to as the (r-1)s complement  The (r-1)s complement of N is obtained as (rn- 1)-N where r = base or radix n = number of digits N = number Therefore 9’s complement of N is (10n-1)- N
  • 42. Example  Give the (r-1)’s complement for the following number if n=6 a. 567894 b. 012598
  • 43. Solution Using the formula (rn-1)-N if n = 6 r = 10 then 106 = 1, 000, 000 rn-1= 1, 000, 000 = 999, 999
  • 44.  A.) N = 567894 999,999 – 567894 = 432105 Therefore, the 9’s complement of 567894 is 432105.  B.) N = 012598 999,999 – 012598 = 987401 Therefore, the 9’s complement of 012598 is 987401.
  • 45. Diminished Radix Complement  Inthe binary number system r=2 then r-1 = 1 so the 1’s complement of N is (2n-1)-N  When a binary digit is subtracted from 1, the only possibilities are 1-0=1 or 1-1=0 Therefore, 1’s complement of a binary numeral is formed by changing 1’s to 0’s and 0’s to 1’s.
  • 46. Example  Compute for the 1’s complement of each of the following binary numbers a. 1001011 b. 010110101 Solution: a. N=1001011 The 1’s complement of 1001011 is 0110100 b. N=010110101 The 1’s complement of 010110101 is 101001010
  • 47. Subtraction with Complements  The subtraction of two n-digit unsigned numbers M – N in base r can be done as follows:  1. Add the minuend M to the r’s complement of the subtrahend N.  If the M >= N, the sum will produce an end carry, rn, which is discarded; what is left is the result M – N  If M < N, the sum does not produce an end carry ans is equal to rn – (N – M), which is the r’s complement of (N – M). To obtain the answer, take the r’s complement of the sum and place a negative sign in front.
  • 48.  Using 10’s complement, subtract 72532 – 3250. M = 72532 10’s complement of N = + 96750 Sum = 169282 Discard end carry 105 = - 100000 Answer = 69282
  • 49.  Using 10’s complement, subtract 3250 – 72532. M = 03250 10’s complement of N = + 27468 Sum = 30718 There is no end carry. Answer = -69282 Get the 10’s complement of 30718.
  • 50.  Using9’s complement, subtract 89 – 23 and 98 – 87.
  • 51. Exercise  Giventwo binary numbers X = 1010100 and Y = 1000011, perform the subtraction (a) X – Y and (b) Y – X using 2’s complements and 1’s complement.
  • 52. Binary Codes Decimal Digit (BCD) Excess-3 8421 0 0000 0011 1 0001 0100 2 0010 0101 In a digital system, 3 0011 0110 it may sometimes represent a binary 4 0100 0111 number, other 5 0101 1000 times some other 6 0110 1001 discrete quantity of information 7 0111 1010 8 1000 1011 9 1001 1100
  • 53. Non Numerical Representations  Itrefers to a representation of data other than numerical values. It refers to the representation of a character, sound or image.
  • 54. Standardizations of Character Codes Codename Description EBCDIC Computer code defined by IBM for general purpose computers. 8 bits represent one character. ASCII 7 bit code established by ANSI (American National Standards Institute). Used in PC’s. ISO Code ISO646 published as a recommendation by the International Organization for Standardization (ISO), based on ASCII 7 bit code for information exchange Unicode An industry standard allowing computers to consistently represent characters used in most of the countries. Every character is represented with 2 bytes.
  • 55. Image and Sound Representations Still Images GIF Format to save graphics, 256 colors displayable JPEG Compression format for color still images Moving Pictures Compression format for color moving pictures MPEG-1 Data stored mainly on CD ROM MPEG-2 Stored images like vide; real time images MPEG-4 Standardization for mobile terminals Sound PCM MIDI Interface to connect a musical instrument with a computer.
  • 56. Operations and Accuracy  Shift operations  It is the operation of shifting a bit string to the right or left. Arithmetic Shift Logical Shift Left Arithmetic Left Shift Logical left shift Right Arithmetic Right Shift Logical Right Shift
  • 57. Arithmetic Shift Arithmetic Shift is an operation of shifting a bit string, except for the sign bit. Example : Shift bits by 1 ALS ARS Sign bit overflow overflow 11111010 11111010 Sign bit 11110100 11111101 Insert a zero in the vacated spot
  • 58. Logical Shift  It shifts a bit string and inserts “0” in places made empty by the shift.  Perform a logical left shift. Shift by 1 bit.  01111010  Perform a logical right shift. Shift by 1 bit.  10011001
  • 59. Exercise  Perform arithmetic right and logical right shifts by 3 bits on the 8th binary number 11001100.

Editor's Notes

  • #39: When the value of the base is substituted… -2’s and 1’s complement for binary numbers -10’s and 9’s complement for decimal numbers