Lecture No. 04
Number and Information Representation
Md. Manowarul Islam, Dept. of CSE, JnU 2
Information Representation
 Numbers are important to computers
 represent information precisely
 can be processed
 For example:
 to represent yes or no: use 0 for no and 1 for yes
 to represent 4 seasons: 0 (autumn), 1 (winter), 2(spring) and 3
(summer)
 NRIC number: a letter, 7 digits, and a check code
 matriculation number (8 alphanumeric) to represent individual
students
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU 3
 Elementary storage units inside computer are
electronic switches. Each switch holds one of two
states: on (1) or off (0).
 We use a bit (binary digit), 0 or 1, to represent the
state.
ON OFF
Information Representation
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU 4
 Storage units can be grouped together to cater for larger
range of numbers. Example: 2 switches to represent 4
values.
0 (00)
1 (01)
2 (10)
3 (11)
Information Representation
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU 5
Positional Notations
 Position-independent notation
 each symbol denotes a value independent of its position:
Egyptian number system
 Relative-position notation
 Roman numerals symbols with different values: I (1), V (5), X
(10), C (50), M (100)
 Examples: I, II, III, IV, VI, VI, VII, VIII, IX
 Relative position important: IV = 4 but VI = 6
 Computations are difficult with the above two notations
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU 6
Positional Notations
 Weighted-positional notation
 Decimal number system, symbols = { 0, 1, 2, 3, …, 9 }
 Position is important
 Example:(7594)10 = (7x103) + (5x102) + (9x101) + (4x100)
 The value of each symbol is dependent on its type and its
position in the number
 In general,
(anan-1… a0)10 = (an x 10n) + (an-1 x 10n-1) + … + (a0 x 100)
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU 7
Positional Notations
 Fractions are written in decimal numbers after the
decimal point.
 (2.75)10 = (2 x 100) + (7 x 10-1) + (5 x 10-2)
 In general,
(anan-1… a0 . f1f2 … fm)10 =
(an x 10n) + (an-1x10n-1) + … + (a0 x 100) +
(f1 x 10-1) + (f2 x 10-2) + … + (fm x 10-m)
 The radix (or base) of the number system is the total
number of digits allowed in the system.
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
Common Number Systems
System Base Symbols
Decimal 10 0, 1, … 9
Binary 2 0, 1
Octal 8 0, 1, … 7
Hexa-decimal 16 0, 1, … 9, A, B, … F
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnUCS1104-2 Information 9
 The digits are consecutive.
 The number of digits is equal to the size of the base.
 Zero is always the first digit.
 The base number is never a digit.
 When 1 is added to the largest digit, a sum of zero and a
carry of one results.
Information Representation
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
Quantities/Counting
Decimal Binary Octal
Hexa-
decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
Quantities/Counting
Decimal Binary Octal
Hexa-
decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnUCS1104-2 Information 12
 Positional Number System
 The word decimal is a derivative of decem, which is the
Latin word for ten.
 Number’s value = a weighted sum of the digits
 In general,
(anan-1… a0)10 = (an x 10n) + (an-1 x 10n-1) + … + (a0 x 100)
 The powers of 10 increment from 0, 1, 2, etc. as you move
right to left
Decimal Number Systems
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnUCS1104-2 Information 13
 Positional Number System
 The word decimal is a derivative of decem, which is the
Latin word for ten.
 Number’s value = a weighted sum of the digits
 In general,
(anan-1… a0)10 = (an x 10n) + (an-1 x 10n-1) + … + (a0 x 100)
 The powers of 10 increment from 0, 1, 2, etc. as you
move right to left
Decimal Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU 14
 Example
Decimal Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
 With only 2 values, can be widely separated, therefore
clearly differentiated
 Binary numbers are made of binary digits
 Binary DigiTs (BITs) can be represented
 electronically:
Binary Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
 Base is 2 or ‘b’ or ‘B’ or ‘Bin’
 Two symbols: 0 and 1
 Each place is weighted by the power of 2
 All the information in the digital computer is represented
as bit patterns
 What is a bit pattern?
 01010101
Binary Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
 Look at this bit pattern
0101 0101
 How many bits are present ?
 Count the number of ones and the zeros in the above
pattern
 Answer = Total 8 bits
Binary Number System
Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 1 0 1 0 1 0 1
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
 A single bit can represent two states:0 1
 Therefore, if you take two bits, you can use them
to represent four unique states:
00, 01, 10, & 11
 And, if you have three bits, then you can use
them to represent eight unique states:
000, 001, 010, 011, 100, 101, 110, & 111
Binary Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
 With every bit you add, you double the number of states
you can represent.
 Therefore, the expression for the number of states with n
bits is 2n.
 Most computers operate on information in groups of 8
bits,
Binary Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 1 0 1 0 1 0 1
 There are 8 bits in the above table
 Group of 4 bits = 1 Nibble
 Group of 8 bits = 1 Byte
 Group of 16 bits = 1 Word 2 Bytes = 1 Word
Decimal Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
Decimal Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Bit positions and their values
Decimal Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
 Base = 8 or ‘o’ or ‘Oct’
 8 symbols: { 0, 1, 2, 3, 4, 5, 6, 7}
 Example 123, 567, 7654 etc
 987 This is incorrect why?
 How to represent a Decimal Number using a Octal
Number System ?
Octal Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
Md. Manowarul Islam, Dept. of CSE, JnU
 Base = 16 or ‘H’ or ‘Hex’
 16 symbols: { 0, 1, 2, 3, 4, 5, 6, 7,8,9 }
 { 10=A, 11=B, 12=C, 13=D, 14=E, 15= F}
 Example AB12, 876F, FFFF etc
Hexadecimal Number System
Md. Obaidur Rahman, Dept. of CSE, EUB
THANK YOU

Lecture 04 number and information representation

  • 1.
    Lecture No. 04 Numberand Information Representation
  • 2.
    Md. Manowarul Islam,Dept. of CSE, JnU 2 Information Representation  Numbers are important to computers  represent information precisely  can be processed  For example:  to represent yes or no: use 0 for no and 1 for yes  to represent 4 seasons: 0 (autumn), 1 (winter), 2(spring) and 3 (summer)  NRIC number: a letter, 7 digits, and a check code  matriculation number (8 alphanumeric) to represent individual students Md. Obaidur Rahman, Dept. of CSE, EUB
  • 3.
    Md. Manowarul Islam,Dept. of CSE, JnU 3  Elementary storage units inside computer are electronic switches. Each switch holds one of two states: on (1) or off (0).  We use a bit (binary digit), 0 or 1, to represent the state. ON OFF Information Representation Md. Obaidur Rahman, Dept. of CSE, EUB
  • 4.
    Md. Manowarul Islam,Dept. of CSE, JnU 4  Storage units can be grouped together to cater for larger range of numbers. Example: 2 switches to represent 4 values. 0 (00) 1 (01) 2 (10) 3 (11) Information Representation Md. Obaidur Rahman, Dept. of CSE, EUB
  • 5.
    Md. Manowarul Islam,Dept. of CSE, JnU 5 Positional Notations  Position-independent notation  each symbol denotes a value independent of its position: Egyptian number system  Relative-position notation  Roman numerals symbols with different values: I (1), V (5), X (10), C (50), M (100)  Examples: I, II, III, IV, VI, VI, VII, VIII, IX  Relative position important: IV = 4 but VI = 6  Computations are difficult with the above two notations Md. Obaidur Rahman, Dept. of CSE, EUB
  • 6.
    Md. Manowarul Islam,Dept. of CSE, JnU 6 Positional Notations  Weighted-positional notation  Decimal number system, symbols = { 0, 1, 2, 3, …, 9 }  Position is important  Example:(7594)10 = (7x103) + (5x102) + (9x101) + (4x100)  The value of each symbol is dependent on its type and its position in the number  In general, (anan-1… a0)10 = (an x 10n) + (an-1 x 10n-1) + … + (a0 x 100) Md. Obaidur Rahman, Dept. of CSE, EUB
  • 7.
    Md. Manowarul Islam,Dept. of CSE, JnU 7 Positional Notations  Fractions are written in decimal numbers after the decimal point.  (2.75)10 = (2 x 100) + (7 x 10-1) + (5 x 10-2)  In general, (anan-1… a0 . f1f2 … fm)10 = (an x 10n) + (an-1x10n-1) + … + (a0 x 100) + (f1 x 10-1) + (f2 x 10-2) + … + (fm x 10-m)  The radix (or base) of the number system is the total number of digits allowed in the system. Md. Obaidur Rahman, Dept. of CSE, EUB
  • 8.
    Md. Manowarul Islam,Dept. of CSE, JnU Common Number Systems System Base Symbols Decimal 10 0, 1, … 9 Binary 2 0, 1 Octal 8 0, 1, … 7 Hexa-decimal 16 0, 1, … 9, A, B, … F Md. Obaidur Rahman, Dept. of CSE, EUB
  • 9.
    Md. Manowarul Islam,Dept. of CSE, JnUCS1104-2 Information 9  The digits are consecutive.  The number of digits is equal to the size of the base.  Zero is always the first digit.  The base number is never a digit.  When 1 is added to the largest digit, a sum of zero and a carry of one results. Information Representation Md. Obaidur Rahman, Dept. of CSE, EUB
  • 10.
    Md. Manowarul Islam,Dept. of CSE, JnU Quantities/Counting Decimal Binary Octal Hexa- decimal 0 0 0 0 1 1 1 1 2 10 2 2 3 11 3 3 4 100 4 4 5 101 5 5 6 110 6 6 7 111 7 7 Md. Obaidur Rahman, Dept. of CSE, EUB
  • 11.
    Md. Manowarul Islam,Dept. of CSE, JnU Quantities/Counting Decimal Binary Octal Hexa- decimal 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F Md. Obaidur Rahman, Dept. of CSE, EUB
  • 12.
    Md. Manowarul Islam,Dept. of CSE, JnUCS1104-2 Information 12  Positional Number System  The word decimal is a derivative of decem, which is the Latin word for ten.  Number’s value = a weighted sum of the digits  In general, (anan-1… a0)10 = (an x 10n) + (an-1 x 10n-1) + … + (a0 x 100)  The powers of 10 increment from 0, 1, 2, etc. as you move right to left Decimal Number Systems Md. Obaidur Rahman, Dept. of CSE, EUB
  • 13.
    Md. Manowarul Islam,Dept. of CSE, JnUCS1104-2 Information 13  Positional Number System  The word decimal is a derivative of decem, which is the Latin word for ten.  Number’s value = a weighted sum of the digits  In general, (anan-1… a0)10 = (an x 10n) + (an-1 x 10n-1) + … + (a0 x 100)  The powers of 10 increment from 0, 1, 2, etc. as you move right to left Decimal Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 14.
    Md. Manowarul Islam,Dept. of CSE, JnU 14  Example Decimal Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 15.
    Md. Manowarul Islam,Dept. of CSE, JnU  With only 2 values, can be widely separated, therefore clearly differentiated  Binary numbers are made of binary digits  Binary DigiTs (BITs) can be represented  electronically: Binary Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 16.
    Md. Manowarul Islam,Dept. of CSE, JnU  Base is 2 or ‘b’ or ‘B’ or ‘Bin’  Two symbols: 0 and 1  Each place is weighted by the power of 2  All the information in the digital computer is represented as bit patterns  What is a bit pattern?  01010101 Binary Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 17.
    Md. Manowarul Islam,Dept. of CSE, JnU  Look at this bit pattern 0101 0101  How many bits are present ?  Count the number of ones and the zeros in the above pattern  Answer = Total 8 bits Binary Number System Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 0 1 0 1 0 1 0 1 Md. Obaidur Rahman, Dept. of CSE, EUB
  • 18.
    Md. Manowarul Islam,Dept. of CSE, JnU  A single bit can represent two states:0 1  Therefore, if you take two bits, you can use them to represent four unique states: 00, 01, 10, & 11  And, if you have three bits, then you can use them to represent eight unique states: 000, 001, 010, 011, 100, 101, 110, & 111 Binary Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 19.
    Md. Manowarul Islam,Dept. of CSE, JnU  With every bit you add, you double the number of states you can represent.  Therefore, the expression for the number of states with n bits is 2n.  Most computers operate on information in groups of 8 bits, Binary Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 20.
    Md. Manowarul Islam,Dept. of CSE, JnU Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 0 1 0 1 0 1 0 1  There are 8 bits in the above table  Group of 4 bits = 1 Nibble  Group of 8 bits = 1 Byte  Group of 16 bits = 1 Word 2 Bytes = 1 Word Decimal Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 21.
    Md. Manowarul Islam,Dept. of CSE, JnU Decimal Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 22.
    Md. Manowarul Islam,Dept. of CSE, JnU Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 27 26 25 24 23 22 21 20 128 64 32 16 8 4 2 1 Bit positions and their values Decimal Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 23.
    Md. Manowarul Islam,Dept. of CSE, JnU  Base = 8 or ‘o’ or ‘Oct’  8 symbols: { 0, 1, 2, 3, 4, 5, 6, 7}  Example 123, 567, 7654 etc  987 This is incorrect why?  How to represent a Decimal Number using a Octal Number System ? Octal Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 24.
    Md. Manowarul Islam,Dept. of CSE, JnU  Base = 16 or ‘H’ or ‘Hex’  16 symbols: { 0, 1, 2, 3, 4, 5, 6, 7,8,9 }  { 10=A, 11=B, 12=C, 13=D, 14=E, 15= F}  Example AB12, 876F, FFFF etc Hexadecimal Number System Md. Obaidur Rahman, Dept. of CSE, EUB
  • 25.