SlideShare a Scribd company logo
011010110011010110011010110011010110101




         Data Representation
                and
          Number System
Data Representation

 • Data:
Data are numbers and other binary-coded information that are
operated on to achieve required computational results.

 • Control Information
Control information is a bit or a group of bits used to specify the
sequence of command signals.
Data Representation
 • Bit:
Binary Digit. 0/1
 • A group of bits in a computer are used to represent many
    different things.
It can represent a number.
It can represent a character.
It can represent an instruction.
 • Byte:
       A group of 8 bits is a byte.
 • Nibble
       A group of 4 bits is a nibble.
Number System: Radix / Base
 • Number System is a code representing quantity.

 • Radix / Base:
A number system of base, or radix, r is a system that uses distinct
symbols for r digits.
In this system the number of states each digit has is determined by the
base or radix.
 • Based on the radix there are four number systems
     o Decimal
     o Binary
     o Octal
     o Hexadecimal
Decimal system
                         Radix / base = 10

 • For example :
253 means                                    0
2*102 + 5*101 + 3*100                        1
                                             2
                                             3
                                             4
• 1,10,100 (from R to L) are the “weights”
                                             5
                                             6
• 10 digits, values 0 through 9
                                             7
                                             8
• After 9 comes 10 (double digits)
                                             9
Binary system
                          Radix / base = 2

 • For example :
                                             0
1011 means 1*23 + 0*22 + 1*21 + 1*20         1


•   2 digits, values 0 and 1
•   1, 2, 4, 8 are the weights
•   After 1 comes 10
•   Count 0 1 10 11 100 101 110 111 1000
Binary system

•   Used to do calculations in all computers
•   Used to store values in memory and on disk
•   Not practical for people
•   Input-Output done in decimal for user
•   Software translates in both directions
Octal system
                        Radix / base = 8

 • For example :
253 means : 2*82 + 5*81 + 3*80                0
                                              1
• 1, 8, 64 are the weights
                                              2
                                              3
• 8 digits, values 0 through 7
                                              4
                                              5
• After 7 comes 10
                                              6
                                              7
 • Used to display memory addresses in some
older computers
Hexadecimal system
                        Radix / base = 16
                                                  A
                                                  B
 • For example :                              0   C
3B6 means 3*162 + B*161 + 6*160               1   D
                                              2   E
                                              3   F
 • 1, 16, 256 are the weights                 4
 • 16 digits, values 0 - 9 and A-F            5
 • After F comes 10                           6
 • Used to display memory addresses in most   7
modern computers e.g., 3C0F 95EA              8
                                              9
Categorizing the Conversion Rule
• Converting from one number system to the other system
  can be categorized as

•   Any radix to Decimal system
•   Decimal system to any radix
•   Octal to binary and hexadecimal to binary
•   Any radix to Any radix (other than binary)
Binary to Decimal Conversion
                                       For Integers

For example: (00101010)2
          0          0           1          0           1          0      1       0

         27          26         25          24         23         22      21      20



 Equals:
 27 * 0 + 26 * 0 + 2 5 * 1 + 24 * 0 + 23 * 1 + 22 * 0 + 21 * 1 + 20 * 0
 = 32 + 8 + 2 = 42

 (00101010)2 = 4210
                                                                 Approach is from LSB to MSB
Exercise

• 1010002 = ( ??? )10               4010
• 10010112 =
                  7510
• 1000112 =
• 0110112 =


                         01001011


  Most Significant Bit                Least Significant Bit
From Decimal to Binary
                              For Integers
 • Divide by 2 until you reach zero, and then collect the
remainders in reverse.


 • For example: 5610 = ( ???? )2
2 ) 56 0                                             Least significant bit
2 ) 28 0
                           2 ) 14 0
                           2)71
                           2)31
                           2)11
                               0                        (0111000)2
Exercise

• (48)10 = ( ????? )2

           (00110000)2
Binary to Decimal
                         With Fraction
Binary point
(10110.10101)2
    1    0     1    1      0    .    1    0     1     0     1

    24   23    22   21     20   .   2-1   2-2   2-3   2-4   2-5


= (1 * 16) + (0 * 8) + (1*4) + (1*2) + (0*1) + ( 1 / 2) + (0 / 4)
+ ( 1 / 8) + ( 0 / 16) + (1 / 32)
= (22.65675) 10
From Decimal to Binary
                             With Fraction

For example:
(56.6875)10 = ( ???? )2
 • Convert the integer and fraction part separately
(56) 10 = (111000)2

 • For fraction part, multiply the fraction part by 2, and each time
discard the integer so obtained.
 • Collect this discarded integer part as the binary equivalent.
 • Repeat this process until zero or until the required accuracy.
0.6875 0.5000
x2x2
1.3750 1.0000

0.3750                         .1011
x2
0.7500
                (56.6875)10 = (111000.1011)2
0.7500
x2
1.5000
Exercise

• (48.3125)10 = ( ????? )2

           (00110000.0101)2
From Decimal to Radix r
• Separate the integer part and fraction part
• Convert the integer part and then fraction part separately.

 • Rule For converting the integer part:
Conversion of a decimal to a base r is done by successive
divisions by r and accumulating the remainders.

This is repeated until the quotient becomes zero.
Collect remainders in the reverse order.
• Rule For converting the decimal part:
Conversion of a decimal to a base r is done by successive
multiplications by r and accumulating the remainders.

• This process is repeated until the fraction parts becomes
  zero or number of digits gives the required accuracy

• Take the integer outputs in the forward direction
From Radix r to Decimal
• Beginning with the rightmost digit multiply each nth digit
   by r(n-1), and add all of the results together (considering the
   position just before the decimal point as the first position.
N = AnRn + An-1Rn-1 + …….A2R2+ A1R1 +A0R0. A1R-1+
A2R-2 +…….
• N - Number
• An - Digit in that position (nth Position)
• R - Radix or base of the system
• - Radix Point
Decimal to Octal Conversion
 • For example: (478.5)10 = ( ?? )8


• Convert the fraction and integer part separately.
• For Integer part:
   o The Division Method: Divide by 8 until you reach
     zero, and then collect the remainders in reverse.

8 ) 478 6
8 ) 59 3 8 ) 7 7
0
                                      (736)8
• For Fraction part:
  o The Multiplication Method: Multiply the fraction part
    successively by 8 and accumulate the remainders until
    you reach zero.

0.5
x 8 (736.4)8
4.0
Octal to Decimal Conversion
 • To convert to base 10, beginning with the rightmost digit
multiply each nth digit by 8(n-1), and add all of the results
together.



For example: (736.4)8
              7           3          6           .          4
              82         81          80          .         8-1



   Equals: 7* 82 + 3 * 81 + 6 * 80 + 4 * 8-1

   = 448+24+6+0.5
   = (478.5)10
Exercise

• (0.40)8 = ______10          0.50
HexaDecimal to Decimal Conversion
• To convert to base 10, beginning with the rightmost digit
  multiply each nth digit by 16(n-1), and add all of the results
  together.

For example: 1F416
                         1              F     4
                        162             161   160



  Equals: 1 * 162 + F * 161 + 4 * 160
  = 256 + 15*16 + 4
  =(500)10
Decimal to Hexa Conversion

• The Division Method. Divide by 16 until you reach zero,
  and then collect the remainders in reverse.
                                               A 10
 For example: 12610 = 7E16                     B 11
16) 126 14 = E                                 C 12
                                               D 13
16) 7 7                                        E 14
0                                              F 15
Exercise



• (AF)16 = ______10




                                 175
Binary to Octal

 • Group the binary number into groups of 3 bits starting from
the least significant bit, and convert it into its decimal equivalent.




 For example: (1 010 101 111)2
 Grouping : 1 010 101 111
 1257
 (1010101111)2 = (1257)8
Octal to Binary
• Take each digit one by one from the string of digits and
  convert each digit into its respective binary number, as a
  group of three bits.

(257)8 = ____2


                     7 is converted as 111
                    5 is converted as 101

                 2 is converted as 010



(257)8 = (010101 111)2                       Binary Triplet Method
Binary -Coded Octal Numbers

Three-bit Group Decimal Digit Octal Digit
000 0 0
001 1 1
010 2 2
011 3 3
100 4 4
101 5 5
110 6 6
111 7 7



001 000 10
010 100 24
Binary to Hexadecimal
 • Group the binary number into groups of 4 bits starting
from the least significant bit, and convert it into its decimal
equivalent.



                                                                  A 10
For example: (1010 1111 0110 0011)2                               B 11
                                                                  C 12
Grouping : 1010 1111 0110 0011                                    D 13
                                                                  E 14
AF63                                                              F 15
(1010111101100011)2 = (AF63)16
Hexadecimal to Binary
• Take each digit one by one from the string of digits and
  convert each digit into its respective binary number, as a
  group of four bits.

(257)16 = ____2


                      7 is converted as 0111
                      5 is converted as 0101

                  2 is converted as 0010



(257)16 = (00100101 0111)2
Hexadecimal to Binary

(BA7)16 = ____2

                                              A 10
                                              B 11
                     7 is converted as 0111   C 12
                     A is converted as 1010   D 13
                                              E 14
                  B is converted as 1011      F 15


(BA7)16 = (10111010 0111)2
Binary-Coded Hexadecimal Numbers
  Four-bit Group Decimal Digit Hexadecimal Digit
  0000 0 0
  0001 1 1
  0010 2 2
  0011 3 3
  0100 4 4
  0101 5 5
  0110 6 6
  0111 7 7
  1000 8 8
  1001 9 9
Binary-Coded Hexadecimal Numbers

              Four-bit Group Decimal Digit Hexadecimal Digit

  1010 10 A
  1011 11 B
  1100 12 C
  1101 13 D
  1110 14 E
  1111 15 F




  0001 0100 14
  0011 0010 50
Binary to octal and hexadecimal
                 EXERCISE

• 1010111101100011   Binary
• 1010111101100011
                     Octal    1275438
• 1010111101100011
                     Hexa     AF6316
• Note:

• The highest digit in octal system is 7 whose binary
  equivalent is 111.

• The highest digit in hexadecimal system in F, whose
  binary equivalent is 1111.
Complements

There are two types of complements for each base r system:

• r’s complement
• ( r-1)’s complement
(r-1)’s complement

• Given a number N in base r having n digit, the (r-1)’s
  complement of N is (rn –1) –N.

• For decimal numbers, there exist 9’s complement.

• For binary numbers, there exist 1’s complement.
9’s Complement
 • For example:
For decimal number N= 546700, n= 6 and r =10
9’s complement equals:
= (rn –1) – N
= (106 –1) - 546700
= (1000000 –1) - 546700
= 999999 – 546700 = 453299

• That is, 9’s complement of a number would be same as
  subtracting each digit from 9.
1’s Complement
 • For example:
For binary number N= 1011, n= 4 and r =2
1’s complement equals:
= (rn –1) – N
= (24 –1) - 1011
= (10000 –1) – 1011 (24 in binary)
= 1111 – 1011= 0100

• That is, 1’s complement of a number would be same as
  subtracting each digit from 1.
1’s Complement

• For a binary number 1011001, 1’s complement can be
  obtained by

    1111111           If you look at the result, you can see, the 1’s
    1011001           complement of a binary number can be obtained by
    _______           reversing the bits.
    0100110
    _______
r’s complement
• Given a number N in base r having n digit, the r’s
  complement of N is rn –N for N < > 0 and 0 for N=0.
• Also, r’s complement is equal to:
     = rn –N
     = rn –N – 1 + 1 (Add and subtract 1)
     = [(rn –1) –N] +1 (Rearranging the terms)
     = (r-1)’s complement + 1




• For decimal numbers, there exist 10’s complement.

• For binary numbers, there exist 2’s complement.
10’s Complement
• For decimal numbers, 10’s complement of a number is
  equal to its 9’s complement +1.

 • For example:
10’s complement of 546700 =
= 9’s complement of 546700 + 1
= 453299 + 1
= 453300
2’s Complement
 • Given a number in binary say N, having ‘n’ digits, then
     2’s complement of N is defined as (2n-N), if N < > 0
     else 0, when N=0

 • For binary numbers, 2’s complement of a number is equal to its 1’s complement
   +1.

 • For example:
2’s complement of 1011 =
= 1’s complement of 1011 + 1
= 0100 +1 = 0101
Exercise
• Find the 2’s complement of 10101011

                                       01010101
• Find the 2’ complement of 01010101


                                       10101011
Integer Representations
• Two different representations exists for integers

• The signed representation: in that case the most
  significant bit (MSB) represents the sign
   o Positive number (or zero) if MSB = 0
   o Negative number if MSB = 1

• The unsigned representation: in that case all the bits are
  used to represent a magnitude
   o It is thus always a positive number or zero
Signed and Unsigned Interpretation

  • To obtain the value of a integer in memory we need to
    chose an interpretation

  • For example: a byte of memory containing 1111 1111
    can represent either one of these numbers:
     o -1 if a signed interpretation (2’s complement) is used
     o 255 if an unsigned interpretation is used
Subtraction of Unsigned Numbers
 • The subtraction of two n-digit unsigned numbers M – N (N < > 0) in
   base r can be done as follows:

 1. Add the minuend M to the r’s complement of the subtrahend N. This
    performs M + (rn – N) = M – N + rn.

Case 1 : If M >= N, the sum will produce an end carry rn which is discarded,
and what is left is the result M – N.

Case 2 : If M < N, the sum does not produce an end carry and is equal to
rn – (N – M), which is the r’s complement of (N – M). To obtain the answer
in a familiar form, take the r’s complement of the sum and place a negative
sign in front.
This will equate to : rn – (rn – ( N – M)) = M - N
Subtraction of Unsigned Numbers

Case 1: Minuend > Subtrahend


 • Take the r’s complement of the subtrahend.
 • Add this to the minuend.
 • Discard the end carry.


                            3456
                            10’s complement of 2234 = 7766
                            _______
   3456 - 2234              11222
   radix 10
                                  Discard the end carry 10000
                                                             1222
Subtraction of Unsigned Numbers

Case 2: Minuend < Subtrahend

 • Take the r’s complement of the subtrahend.
 • Add this to the minuend.
 • Find the r’s complement of the result and append a negative sign in front of it.



                              2234
                              10’s complement of 3456 = 6544
                              _______
    2234 - 3456               8778
    radix 10

                                                                   -1222
                             10’s complement of 8778
Subtraction of Unsigned Numbers


• In case 2, after the 10’s complement of 8778, we get 1222 only and not -1222.

• When working manually it can be noticed that the subtrahend
  is > minuend and so it needs a -ve sign for the result.

• When subtracting with complements it is found that the
  answer where there is no end carry and a negative sign
  should be added.
Subtraction of Unsigned Numbers
 • In a similar manner, the subtraction with complements is done with
    binary numbers.
 • For example:
X: 1010100
Y: 1000011

 • To perform X – Y :
X = 1010100
2’s complement of Y = 0111101
Sum = 10010001
    Discard the end carry 10000000



                                        0010001
Exercise

Y: 1000011
X: 1010100
radix 2

Perform Y – X = ????



             - 0010001
1’s Complement Subtraction
         Unsigned representation
   Case 1: Minuend > Subtrahend (M – N)

   • Take the 1’s complement of the subtrahend.
   • Add this to the minuend.
   • Remove the carry and add it to the result. This is called END AROUND
     CARRY.



                          00011101
                          1’s complement of 00011011= 11100100
00011101- 00011011        _________
radix 2                   100000001
                          1
                                        RESULT          00000010
1’s Complement Subtraction
      Unsigned Representation
Case 2: Minuend < Subtrahend

• Take the 1’s complement of the subtrahend.
• Add this to the minuend.
• Find the 1’s complement of the result and append a negative sign in front of it.




                       00011001
                       1’s complement of 00011101 = 11100010 11111011
00011001 - 00011101
radix 2

                                    RESULT              -00000100
Exercise (using 1’s complement)

X: 00110011
Y: 00101101 Perform X - Y
radix 2

                     00000110
Signed Representation
 • In signed representation, the most significant bit (MSB) represents the
   sign.

 • When a binary number is positive, the sign is represented by 0 and the
   magnitude by a positive binary number.

 • When the number is negative, the sign is represented by 1 but the rest of
   the number may be represented in three possible ways.

1. Signed magnitude representation
2. Signed - 1’s complement representation
3. Signed - 2’s complement representation.
Example for Negative number
          Representation
 • To represent -14

1. Signed magnitude representation
1 0001110

Note : This representation of – 14 is obtained from +14 by
complementing only the sign bit.



2. Signed - 1’s complement representation
1 1110001

Note : This representation of – 14 is obtained by complementing all
the bits of + 14, including the sign bit.
Example for Negative number
        Representation
3. Signed - 2’s complement representation.
1 1110010

Note : This representation of – 14 is obtained by taking the 2’s
complement of +14, including the sign bit.
Advantage of 2’s Complement
           System
• Representing in 2’s complement is preferred over 1’s
  complement as well as signed magnitude system.

• Representing in signed magnitude is easy for manual
  arithmetic processing and not for the computer.

• The reason is 1’s complement takes two representation for
  +0 and -0 which is absurd.

• In 2’s complement system both -0 and +0 will have the same
  representation
NOTE

1’s complement form
 • + 0 in binary 00000000
 • - 0 in 1’s complement form 11111111
Two representations of –0 and +0, which is absurd.

2’s complement form
 • + 0 in binary 00000000
 • - 0 in 2’s complement form 00000000
Same representation of +0 and –0.
END

More Related Content

What's hot

Binary octal
Binary octalBinary octal
Binary octaldrdipo4
 
Number system
Number systemNumber system
Number system
Sajib
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
Vaagdevi College of Engineering
 
BINARY NUMBER SYSTEM
BINARY NUMBER SYSTEMBINARY NUMBER SYSTEM
BINARY NUMBER SYSTEM
Zaheer Abbasi
 
Number System
Number SystemNumber System
Number System
Zahid Rajeel
 
Binary codes
Binary codesBinary codes
Binary codes
GargiKhanna1
 
NUMBER SYSTEM
NUMBER SYSTEMNUMBER SYSTEM
Conversion of number system with base concept
Conversion of number system with base conceptConversion of number system with base concept
Conversion of number system with base concept
University of Potsdam
 
01.number systems
01.number systems01.number systems
01.number systems
Sripati Mahapatra
 
Introduction to the Binary Number System
Introduction to the Binary Number SystemIntroduction to the Binary Number System
Introduction to the Binary Number SystemJames Hamilton
 
Overview of character encoding
Overview of character encodingOverview of character encoding
Overview of character encoding
Duy Lâm
 
Two’s complement
Two’s complementTwo’s complement
Two’s complement
mayannpolisticoLNU
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number system
Nallapati Anindra
 
binary number system
 binary number system binary number system
binary number system
vishal gupta
 
BCD.
BCD.BCD.
Number system
Number systemNumber system
Number system
Suraj Bora
 
Chapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemChapter 2.1 introduction to number system
Chapter 2.1 introduction to number system
ISMT College
 
Breadth first search (Bfs)
Breadth first search (Bfs)Breadth first search (Bfs)
Breadth first search (Bfs)
Ishucs
 
Number system
Number systemNumber system
Number system
Darpan Chelani
 

What's hot (20)

Binary octal
Binary octalBinary octal
Binary octal
 
Number system
Number systemNumber system
Number system
 
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
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
 
BINARY NUMBER SYSTEM
BINARY NUMBER SYSTEMBINARY NUMBER SYSTEM
BINARY NUMBER SYSTEM
 
Number System
Number SystemNumber System
Number System
 
Binary codes
Binary codesBinary codes
Binary codes
 
NUMBER SYSTEM
NUMBER SYSTEMNUMBER SYSTEM
NUMBER SYSTEM
 
Conversion of number system with base concept
Conversion of number system with base conceptConversion of number system with base concept
Conversion of number system with base concept
 
01.number systems
01.number systems01.number systems
01.number systems
 
Introduction to the Binary Number System
Introduction to the Binary Number SystemIntroduction to the Binary Number System
Introduction to the Binary Number System
 
Overview of character encoding
Overview of character encodingOverview of character encoding
Overview of character encoding
 
Two’s complement
Two’s complementTwo’s complement
Two’s complement
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number system
 
binary number system
 binary number system binary number system
binary number system
 
BCD.
BCD.BCD.
BCD.
 
Number system
Number systemNumber system
Number system
 
Chapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemChapter 2.1 introduction to number system
Chapter 2.1 introduction to number system
 
Breadth first search (Bfs)
Breadth first search (Bfs)Breadth first search (Bfs)
Breadth first search (Bfs)
 
Number system
Number systemNumber system
Number system
 

Viewers also liked

Number System
Number SystemNumber System
Number System
samarthagrawal
 
number system school ppt ninth class
number system school ppt ninth classnumber system school ppt ninth class
number system school ppt ninth class
Manan Jain
 
Number system part 1
Number  system part 1Number  system part 1
Number system part 1
Excel Technology Lanka (Pvt) Ltd
 
1.1 real number system dfs
1.1 real number system dfs1.1 real number system dfs
1.1 real number system dfs
Farhana Shaheen
 
Oop design principles (2013 08 16 19_18_36 utc)
Oop design principles (2013 08 16 19_18_36 utc)Oop design principles (2013 08 16 19_18_36 utc)
Oop design principles (2013 08 16 19_18_36 utc)
Sayed Ahmed
 
Cmp104 lec 2 number system
Cmp104 lec 2 number systemCmp104 lec 2 number system
Cmp104 lec 2 number systemkapil078
 
Mba i-ifm-u-1- computer hardware system
Mba i-ifm-u-1- computer hardware systemMba i-ifm-u-1- computer hardware system
Mba i-ifm-u-1- computer hardware system
Rai University
 
Number System & Data Representation
Number System & Data RepresentationNumber System & Data Representation
Number System & Data Representation
Phillip Glenn Libay
 
Number System in CoMpUtEr
Number System in CoMpUtErNumber System in CoMpUtEr
Number System in CoMpUtEr
vishal bansal
 
Math aruthmetic geometric series
Math aruthmetic geometric seriesMath aruthmetic geometric series
Math aruthmetic geometric series
student
 
Lesson 3 Operating System Functions
Lesson 3 Operating System FunctionsLesson 3 Operating System Functions
Lesson 3 Operating System Functions
Laguna State Polytechnic University
 
Software Engineering-R.D.Sivakumar
Software Engineering-R.D.SivakumarSoftware Engineering-R.D.Sivakumar
Software Engineering-R.D.Sivakumar
Sivakumar R D .
 
Scientific notation
Scientific notationScientific notation
Scientific notation
julienorman80065
 
Math10 1 Lecture1
Math10 1 Lecture1Math10 1 Lecture1
Math10 1 Lecture1
hdsierra
 
matter in our surrounding
matter in our surroundingmatter in our surrounding
matter in our surrounding
Bhavya .A. Patel
 
Data handling
Data handlingData handling
Data handling
Rayna2002
 

Viewers also liked (20)

Number System
Number SystemNumber System
Number System
 
number system school ppt ninth class
number system school ppt ninth classnumber system school ppt ninth class
number system school ppt ninth class
 
Number system part 1
Number  system part 1Number  system part 1
Number system part 1
 
1.1 real number system dfs
1.1 real number system dfs1.1 real number system dfs
1.1 real number system dfs
 
Number scale
Number scaleNumber scale
Number scale
 
Oop design principles (2013 08 16 19_18_36 utc)
Oop design principles (2013 08 16 19_18_36 utc)Oop design principles (2013 08 16 19_18_36 utc)
Oop design principles (2013 08 16 19_18_36 utc)
 
Cmp104 lec 2 number system
Cmp104 lec 2 number systemCmp104 lec 2 number system
Cmp104 lec 2 number system
 
Mba i-ifm-u-1- computer hardware system
Mba i-ifm-u-1- computer hardware systemMba i-ifm-u-1- computer hardware system
Mba i-ifm-u-1- computer hardware system
 
Number System & Data Representation
Number System & Data RepresentationNumber System & Data Representation
Number System & Data Representation
 
Number System in CoMpUtEr
Number System in CoMpUtErNumber System in CoMpUtEr
Number System in CoMpUtEr
 
Math aruthmetic geometric series
Math aruthmetic geometric seriesMath aruthmetic geometric series
Math aruthmetic geometric series
 
Lesson 3 Operating System Functions
Lesson 3 Operating System FunctionsLesson 3 Operating System Functions
Lesson 3 Operating System Functions
 
Software Engineering-R.D.Sivakumar
Software Engineering-R.D.SivakumarSoftware Engineering-R.D.Sivakumar
Software Engineering-R.D.Sivakumar
 
Scientific notation
Scientific notationScientific notation
Scientific notation
 
DEL-244Chep i
DEL-244Chep iDEL-244Chep i
DEL-244Chep i
 
Bits and bytes
Bits and bytesBits and bytes
Bits and bytes
 
Math10 1 Lecture1
Math10 1 Lecture1Math10 1 Lecture1
Math10 1 Lecture1
 
Number types
Number typesNumber types
Number types
 
matter in our surrounding
matter in our surroundingmatter in our surrounding
matter in our surrounding
 
Data handling
Data handlingData handling
Data handling
 

Similar to Number system

Digital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdfDigital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdf
Kannan Kanagaraj
 
Cse115 lecture01numbersystems
Cse115 lecture01numbersystemsCse115 lecture01numbersystems
Cse115 lecture01numbersystems
Md. Ashikur Rahman
 
L 2.10
L 2.10L 2.10
More on number system
More on number systemMore on number system
More on number system
samina khan
 
Number systems r002
Number systems  r002Number systems  r002
Number systems r002
arunachalamr16
 
DATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxDATA REPRESENTATION.pptx
DATA REPRESENTATION.pptx
MamataAnilgod
 
Number system
Number systemNumber system
Number systemkashee99
 
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
hemangipednekar0812
 
02 number systems
02 number systems02 number systems
02 number systems
john01383
 
Computer number systems
Computer number systemsComputer number systems
Computer number systemsRevi Shahini
 
Number systems
Number systemsNumber systems
Number systemsKumar
 
Digital Electronics Notes.pdf
Digital Electronics Notes.pdfDigital Electronics Notes.pdf
Digital Electronics Notes.pdf
4NM21IS132SAISHARATH
 
Lecture-2(2): Number System & Conversion
Lecture-2(2): Number System & ConversionLecture-2(2): Number System & Conversion
Lecture-2(2): Number System & Conversion
Mubashir Ali
 
Number system by ammar nawab
Number system by ammar nawabNumber system by ammar nawab
Number system by ammar nawab
Ammar_n
 
Number systems
Number systemsNumber systems
Number systems
Mustafa Salah
 
09 binary number systems
09   binary number systems09   binary number systems
09 binary number systems
Lee Chadwick
 
2.1 data represent on cpu
2.1 data represent on cpu2.1 data represent on cpu
2.1 data represent on cpuWan Afirah
 
Number system
Number systemNumber system
Number system
rameshthombre1
 
Sistem bilangan
Sistem bilanganSistem bilangan
Sistem bilangan
adealfarisi
 

Similar to Number system (20)

Digital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdfDigital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdf
 
Cse115 lecture01numbersystems
Cse115 lecture01numbersystemsCse115 lecture01numbersystems
Cse115 lecture01numbersystems
 
L 2.10
L 2.10L 2.10
L 2.10
 
More on number system
More on number systemMore on number system
More on number system
 
1. basic theories of information
1. basic theories of information1. basic theories of information
1. basic theories of information
 
Number systems r002
Number systems  r002Number systems  r002
Number systems r002
 
DATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxDATA REPRESENTATION.pptx
DATA REPRESENTATION.pptx
 
Number system
Number systemNumber system
Number system
 
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
 
02 number systems
02 number systems02 number systems
02 number systems
 
Computer number systems
Computer number systemsComputer number systems
Computer number systems
 
Number systems
Number systemsNumber systems
Number systems
 
Digital Electronics Notes.pdf
Digital Electronics Notes.pdfDigital Electronics Notes.pdf
Digital Electronics Notes.pdf
 
Lecture-2(2): Number System & Conversion
Lecture-2(2): Number System & ConversionLecture-2(2): Number System & Conversion
Lecture-2(2): Number System & Conversion
 
Number system by ammar nawab
Number system by ammar nawabNumber system by ammar nawab
Number system by ammar nawab
 
Number systems
Number systemsNumber systems
Number systems
 
09 binary number systems
09   binary number systems09   binary number systems
09 binary number systems
 
2.1 data represent on cpu
2.1 data represent on cpu2.1 data represent on cpu
2.1 data represent on cpu
 
Number system
Number systemNumber system
Number system
 
Sistem bilangan
Sistem bilanganSistem bilangan
Sistem bilangan
 

More from Aditya Sharat

Neural networks
Neural networksNeural networks
Neural networks
Aditya Sharat
 
Google apps cloud computing
Google apps cloud computingGoogle apps cloud computing
Google apps cloud computing
Aditya Sharat
 
Deloitte's Cloud Perspectives
Deloitte's Cloud PerspectivesDeloitte's Cloud Perspectives
Deloitte's Cloud Perspectives
Aditya Sharat
 
Virtual Reality
Virtual RealityVirtual Reality
Virtual Reality
Aditya Sharat
 
Generation of computers
Generation of computersGeneration of computers
Generation of computers
Aditya Sharat
 
Flow charts
Flow chartsFlow charts
Flow charts
Aditya Sharat
 
Electronic computer classification
Electronic computer classificationElectronic computer classification
Electronic computer classificationAditya Sharat
 
Language translators
Language translatorsLanguage translators
Language translatorsAditya Sharat
 
Unix shell program training
Unix shell program trainingUnix shell program training
Unix shell program training
Aditya Sharat
 
Railway Management system
Railway Management systemRailway Management system
Railway Management system
Aditya Sharat
 
Mobile communication
Mobile communicationMobile communication
Mobile communication
Aditya Sharat
 
IS95 CDMA Technology
IS95 CDMA TechnologyIS95 CDMA Technology
IS95 CDMA Technology
Aditya Sharat
 

More from Aditya Sharat (16)

Neural networks
Neural networksNeural networks
Neural networks
 
Google apps cloud computing
Google apps cloud computingGoogle apps cloud computing
Google apps cloud computing
 
Deloitte's Cloud Perspectives
Deloitte's Cloud PerspectivesDeloitte's Cloud Perspectives
Deloitte's Cloud Perspectives
 
Virtual Reality
Virtual RealityVirtual Reality
Virtual Reality
 
Introduction to IT
Introduction to ITIntroduction to IT
Introduction to IT
 
Humanware
HumanwareHumanware
Humanware
 
Generation of computers
Generation of computersGeneration of computers
Generation of computers
 
Flow charts
Flow chartsFlow charts
Flow charts
 
Electronic computer classification
Electronic computer classificationElectronic computer classification
Electronic computer classification
 
Language translators
Language translatorsLanguage translators
Language translators
 
MCS
MCSMCS
MCS
 
Unix shell program training
Unix shell program trainingUnix shell program training
Unix shell program training
 
Railway Management system
Railway Management systemRailway Management system
Railway Management system
 
Mobile communication
Mobile communicationMobile communication
Mobile communication
 
Conducting polymers
Conducting polymersConducting polymers
Conducting polymers
 
IS95 CDMA Technology
IS95 CDMA TechnologyIS95 CDMA Technology
IS95 CDMA Technology
 

Recently uploaded

TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 

Recently uploaded (20)

TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 

Number system

  • 1. 011010110011010110011010110011010110101 Data Representation and Number System
  • 2. Data Representation • Data: Data are numbers and other binary-coded information that are operated on to achieve required computational results. • Control Information Control information is a bit or a group of bits used to specify the sequence of command signals.
  • 3. Data Representation • Bit: Binary Digit. 0/1 • A group of bits in a computer are used to represent many different things. It can represent a number. It can represent a character. It can represent an instruction. • Byte: A group of 8 bits is a byte. • Nibble A group of 4 bits is a nibble.
  • 4. Number System: Radix / Base • Number System is a code representing quantity. • Radix / Base: A number system of base, or radix, r is a system that uses distinct symbols for r digits. In this system the number of states each digit has is determined by the base or radix. • Based on the radix there are four number systems o Decimal o Binary o Octal o Hexadecimal
  • 5. Decimal system Radix / base = 10 • For example : 253 means 0 2*102 + 5*101 + 3*100 1 2 3 4 • 1,10,100 (from R to L) are the “weights” 5 6 • 10 digits, values 0 through 9 7 8 • After 9 comes 10 (double digits) 9
  • 6. Binary system Radix / base = 2 • For example : 0 1011 means 1*23 + 0*22 + 1*21 + 1*20 1 • 2 digits, values 0 and 1 • 1, 2, 4, 8 are the weights • After 1 comes 10 • Count 0 1 10 11 100 101 110 111 1000
  • 7. Binary system • Used to do calculations in all computers • Used to store values in memory and on disk • Not practical for people • Input-Output done in decimal for user • Software translates in both directions
  • 8. Octal system Radix / base = 8 • For example : 253 means : 2*82 + 5*81 + 3*80 0 1 • 1, 8, 64 are the weights 2 3 • 8 digits, values 0 through 7 4 5 • After 7 comes 10 6 7 • Used to display memory addresses in some older computers
  • 9. Hexadecimal system Radix / base = 16 A B • For example : 0 C 3B6 means 3*162 + B*161 + 6*160 1 D 2 E 3 F • 1, 16, 256 are the weights 4 • 16 digits, values 0 - 9 and A-F 5 • After F comes 10 6 • Used to display memory addresses in most 7 modern computers e.g., 3C0F 95EA 8 9
  • 10. Categorizing the Conversion Rule • Converting from one number system to the other system can be categorized as • Any radix to Decimal system • Decimal system to any radix • Octal to binary and hexadecimal to binary • Any radix to Any radix (other than binary)
  • 11. Binary to Decimal Conversion For Integers For example: (00101010)2 0 0 1 0 1 0 1 0 27 26 25 24 23 22 21 20 Equals: 27 * 0 + 26 * 0 + 2 5 * 1 + 24 * 0 + 23 * 1 + 22 * 0 + 21 * 1 + 20 * 0 = 32 + 8 + 2 = 42 (00101010)2 = 4210 Approach is from LSB to MSB
  • 12. Exercise • 1010002 = ( ??? )10 4010 • 10010112 = 7510 • 1000112 = • 0110112 = 01001011 Most Significant Bit Least Significant Bit
  • 13. From Decimal to Binary For Integers • Divide by 2 until you reach zero, and then collect the remainders in reverse. • For example: 5610 = ( ???? )2 2 ) 56 0 Least significant bit 2 ) 28 0 2 ) 14 0 2)71 2)31 2)11 0 (0111000)2
  • 14. Exercise • (48)10 = ( ????? )2 (00110000)2
  • 15. Binary to Decimal With Fraction Binary point (10110.10101)2 1 0 1 1 0 . 1 0 1 0 1 24 23 22 21 20 . 2-1 2-2 2-3 2-4 2-5 = (1 * 16) + (0 * 8) + (1*4) + (1*2) + (0*1) + ( 1 / 2) + (0 / 4) + ( 1 / 8) + ( 0 / 16) + (1 / 32) = (22.65675) 10
  • 16. From Decimal to Binary With Fraction For example: (56.6875)10 = ( ???? )2 • Convert the integer and fraction part separately (56) 10 = (111000)2 • For fraction part, multiply the fraction part by 2, and each time discard the integer so obtained. • Collect this discarded integer part as the binary equivalent. • Repeat this process until zero or until the required accuracy.
  • 17. 0.6875 0.5000 x2x2 1.3750 1.0000 0.3750 .1011 x2 0.7500 (56.6875)10 = (111000.1011)2 0.7500 x2 1.5000
  • 18. Exercise • (48.3125)10 = ( ????? )2 (00110000.0101)2
  • 19. From Decimal to Radix r • Separate the integer part and fraction part • Convert the integer part and then fraction part separately. • Rule For converting the integer part: Conversion of a decimal to a base r is done by successive divisions by r and accumulating the remainders. This is repeated until the quotient becomes zero. Collect remainders in the reverse order.
  • 20. • Rule For converting the decimal part: Conversion of a decimal to a base r is done by successive multiplications by r and accumulating the remainders. • This process is repeated until the fraction parts becomes zero or number of digits gives the required accuracy • Take the integer outputs in the forward direction
  • 21. From Radix r to Decimal • Beginning with the rightmost digit multiply each nth digit by r(n-1), and add all of the results together (considering the position just before the decimal point as the first position. N = AnRn + An-1Rn-1 + …….A2R2+ A1R1 +A0R0. A1R-1+ A2R-2 +……. • N - Number • An - Digit in that position (nth Position) • R - Radix or base of the system • - Radix Point
  • 22. Decimal to Octal Conversion • For example: (478.5)10 = ( ?? )8 • Convert the fraction and integer part separately. • For Integer part: o The Division Method: Divide by 8 until you reach zero, and then collect the remainders in reverse. 8 ) 478 6 8 ) 59 3 8 ) 7 7 0 (736)8
  • 23. • For Fraction part: o The Multiplication Method: Multiply the fraction part successively by 8 and accumulate the remainders until you reach zero. 0.5 x 8 (736.4)8 4.0
  • 24. Octal to Decimal Conversion • To convert to base 10, beginning with the rightmost digit multiply each nth digit by 8(n-1), and add all of the results together. For example: (736.4)8 7 3 6 . 4 82 81 80 . 8-1 Equals: 7* 82 + 3 * 81 + 6 * 80 + 4 * 8-1 = 448+24+6+0.5 = (478.5)10
  • 25. Exercise • (0.40)8 = ______10 0.50
  • 26. HexaDecimal to Decimal Conversion • To convert to base 10, beginning with the rightmost digit multiply each nth digit by 16(n-1), and add all of the results together. For example: 1F416 1 F 4 162 161 160 Equals: 1 * 162 + F * 161 + 4 * 160 = 256 + 15*16 + 4 =(500)10
  • 27. Decimal to Hexa Conversion • The Division Method. Divide by 16 until you reach zero, and then collect the remainders in reverse. A 10 For example: 12610 = 7E16 B 11 16) 126 14 = E C 12 D 13 16) 7 7 E 14 0 F 15
  • 28. Exercise • (AF)16 = ______10 175
  • 29. Binary to Octal • Group the binary number into groups of 3 bits starting from the least significant bit, and convert it into its decimal equivalent. For example: (1 010 101 111)2 Grouping : 1 010 101 111 1257 (1010101111)2 = (1257)8
  • 30. Octal to Binary • Take each digit one by one from the string of digits and convert each digit into its respective binary number, as a group of three bits. (257)8 = ____2 7 is converted as 111 5 is converted as 101 2 is converted as 010 (257)8 = (010101 111)2 Binary Triplet Method
  • 31. Binary -Coded Octal Numbers Three-bit Group Decimal Digit Octal Digit 000 0 0 001 1 1 010 2 2 011 3 3 100 4 4 101 5 5 110 6 6 111 7 7 001 000 10 010 100 24
  • 32. Binary to Hexadecimal • Group the binary number into groups of 4 bits starting from the least significant bit, and convert it into its decimal equivalent. A 10 For example: (1010 1111 0110 0011)2 B 11 C 12 Grouping : 1010 1111 0110 0011 D 13 E 14 AF63 F 15 (1010111101100011)2 = (AF63)16
  • 33. Hexadecimal to Binary • Take each digit one by one from the string of digits and convert each digit into its respective binary number, as a group of four bits. (257)16 = ____2 7 is converted as 0111 5 is converted as 0101 2 is converted as 0010 (257)16 = (00100101 0111)2
  • 34. Hexadecimal to Binary (BA7)16 = ____2 A 10 B 11 7 is converted as 0111 C 12 A is converted as 1010 D 13 E 14 B is converted as 1011 F 15 (BA7)16 = (10111010 0111)2
  • 35. Binary-Coded Hexadecimal Numbers Four-bit Group Decimal Digit Hexadecimal Digit 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9
  • 36. Binary-Coded Hexadecimal Numbers Four-bit Group Decimal Digit Hexadecimal Digit 1010 10 A 1011 11 B 1100 12 C 1101 13 D 1110 14 E 1111 15 F 0001 0100 14 0011 0010 50
  • 37. Binary to octal and hexadecimal EXERCISE • 1010111101100011 Binary • 1010111101100011 Octal 1275438 • 1010111101100011 Hexa AF6316
  • 38. • Note: • The highest digit in octal system is 7 whose binary equivalent is 111. • The highest digit in hexadecimal system in F, whose binary equivalent is 1111.
  • 39. Complements There are two types of complements for each base r system: • r’s complement • ( r-1)’s complement
  • 40. (r-1)’s complement • Given a number N in base r having n digit, the (r-1)’s complement of N is (rn –1) –N. • For decimal numbers, there exist 9’s complement. • For binary numbers, there exist 1’s complement.
  • 41. 9’s Complement • For example: For decimal number N= 546700, n= 6 and r =10 9’s complement equals: = (rn –1) – N = (106 –1) - 546700 = (1000000 –1) - 546700 = 999999 – 546700 = 453299 • That is, 9’s complement of a number would be same as subtracting each digit from 9.
  • 42. 1’s Complement • For example: For binary number N= 1011, n= 4 and r =2 1’s complement equals: = (rn –1) – N = (24 –1) - 1011 = (10000 –1) – 1011 (24 in binary) = 1111 – 1011= 0100 • That is, 1’s complement of a number would be same as subtracting each digit from 1.
  • 43. 1’s Complement • For a binary number 1011001, 1’s complement can be obtained by 1111111 If you look at the result, you can see, the 1’s 1011001 complement of a binary number can be obtained by _______ reversing the bits. 0100110 _______
  • 44. r’s complement • Given a number N in base r having n digit, the r’s complement of N is rn –N for N < > 0 and 0 for N=0. • Also, r’s complement is equal to: = rn –N = rn –N – 1 + 1 (Add and subtract 1) = [(rn –1) –N] +1 (Rearranging the terms) = (r-1)’s complement + 1 • For decimal numbers, there exist 10’s complement. • For binary numbers, there exist 2’s complement.
  • 45. 10’s Complement • For decimal numbers, 10’s complement of a number is equal to its 9’s complement +1. • For example: 10’s complement of 546700 = = 9’s complement of 546700 + 1 = 453299 + 1 = 453300
  • 46. 2’s Complement • Given a number in binary say N, having ‘n’ digits, then 2’s complement of N is defined as (2n-N), if N < > 0 else 0, when N=0 • For binary numbers, 2’s complement of a number is equal to its 1’s complement +1. • For example: 2’s complement of 1011 = = 1’s complement of 1011 + 1 = 0100 +1 = 0101
  • 47. Exercise • Find the 2’s complement of 10101011 01010101 • Find the 2’ complement of 01010101 10101011
  • 48. Integer Representations • Two different representations exists for integers • The signed representation: in that case the most significant bit (MSB) represents the sign o Positive number (or zero) if MSB = 0 o Negative number if MSB = 1 • The unsigned representation: in that case all the bits are used to represent a magnitude o It is thus always a positive number or zero
  • 49. Signed and Unsigned Interpretation • To obtain the value of a integer in memory we need to chose an interpretation • For example: a byte of memory containing 1111 1111 can represent either one of these numbers: o -1 if a signed interpretation (2’s complement) is used o 255 if an unsigned interpretation is used
  • 50. Subtraction of Unsigned Numbers • The subtraction of two n-digit unsigned numbers M – N (N < > 0) in base r can be done as follows: 1. Add the minuend M to the r’s complement of the subtrahend N. This performs M + (rn – N) = M – N + rn. Case 1 : If M >= N, the sum will produce an end carry rn which is discarded, and what is left is the result M – N. Case 2 : If M < N, the sum does not produce an end carry and is equal to rn – (N – M), which is the r’s complement of (N – M). To obtain the answer in a familiar form, take the r’s complement of the sum and place a negative sign in front. This will equate to : rn – (rn – ( N – M)) = M - N
  • 51. Subtraction of Unsigned Numbers Case 1: Minuend > Subtrahend • Take the r’s complement of the subtrahend. • Add this to the minuend. • Discard the end carry. 3456 10’s complement of 2234 = 7766 _______ 3456 - 2234 11222 radix 10 Discard the end carry 10000 1222
  • 52. Subtraction of Unsigned Numbers Case 2: Minuend < Subtrahend • Take the r’s complement of the subtrahend. • Add this to the minuend. • Find the r’s complement of the result and append a negative sign in front of it. 2234 10’s complement of 3456 = 6544 _______ 2234 - 3456 8778 radix 10 -1222 10’s complement of 8778
  • 53. Subtraction of Unsigned Numbers • In case 2, after the 10’s complement of 8778, we get 1222 only and not -1222. • When working manually it can be noticed that the subtrahend is > minuend and so it needs a -ve sign for the result. • When subtracting with complements it is found that the answer where there is no end carry and a negative sign should be added.
  • 54. Subtraction of Unsigned Numbers • In a similar manner, the subtraction with complements is done with binary numbers. • For example: X: 1010100 Y: 1000011 • To perform X – Y : X = 1010100 2’s complement of Y = 0111101 Sum = 10010001 Discard the end carry 10000000 0010001
  • 55. Exercise Y: 1000011 X: 1010100 radix 2 Perform Y – X = ???? - 0010001
  • 56. 1’s Complement Subtraction Unsigned representation Case 1: Minuend > Subtrahend (M – N) • Take the 1’s complement of the subtrahend. • Add this to the minuend. • Remove the carry and add it to the result. This is called END AROUND CARRY. 00011101 1’s complement of 00011011= 11100100 00011101- 00011011 _________ radix 2 100000001 1 RESULT 00000010
  • 57. 1’s Complement Subtraction Unsigned Representation Case 2: Minuend < Subtrahend • Take the 1’s complement of the subtrahend. • Add this to the minuend. • Find the 1’s complement of the result and append a negative sign in front of it. 00011001 1’s complement of 00011101 = 11100010 11111011 00011001 - 00011101 radix 2 RESULT -00000100
  • 58. Exercise (using 1’s complement) X: 00110011 Y: 00101101 Perform X - Y radix 2 00000110
  • 59. Signed Representation • In signed representation, the most significant bit (MSB) represents the sign. • When a binary number is positive, the sign is represented by 0 and the magnitude by a positive binary number. • When the number is negative, the sign is represented by 1 but the rest of the number may be represented in three possible ways. 1. Signed magnitude representation 2. Signed - 1’s complement representation 3. Signed - 2’s complement representation.
  • 60. Example for Negative number Representation • To represent -14 1. Signed magnitude representation 1 0001110 Note : This representation of – 14 is obtained from +14 by complementing only the sign bit. 2. Signed - 1’s complement representation 1 1110001 Note : This representation of – 14 is obtained by complementing all the bits of + 14, including the sign bit.
  • 61. Example for Negative number Representation 3. Signed - 2’s complement representation. 1 1110010 Note : This representation of – 14 is obtained by taking the 2’s complement of +14, including the sign bit.
  • 62. Advantage of 2’s Complement System • Representing in 2’s complement is preferred over 1’s complement as well as signed magnitude system. • Representing in signed magnitude is easy for manual arithmetic processing and not for the computer. • The reason is 1’s complement takes two representation for +0 and -0 which is absurd. • In 2’s complement system both -0 and +0 will have the same representation
  • 63. NOTE 1’s complement form • + 0 in binary 00000000 • - 0 in 1’s complement form 11111111 Two representations of –0 and +0, which is absurd. 2’s complement form • + 0 in binary 00000000 • - 0 in 2’s complement form 00000000 Same representation of +0 and –0.
  • 64. END