Numbering System &
Computer Arithmetic
John G Kaira
How Computers Represent Data
• All symbols, pictures or words must be reduced
to a string of binary digits.
• A binary digit is called a bit and represents either
a 0 or a 1.
• These are the only digits in the binary or base 2,
number system used by computers.
• A string of eight bits used to store one number or
character in a computer system is called a byte
(see Figure 0.2).
• Two common coding systems are Extended
Binary Coded Decimal Interchange Code
(EBCDIC) and American Standard Code for
Information Interchange (ASCII). See Table 0.1.
• EBCDIC represents every number, alphabetic
character, or special character with eight bits,
used primarily in IBM and other mainframe
computers.
• ASCII was originally designed as a seven-bit
code, but most computers use eight-bit versions.
• ASCII is used in data transmission, PCs and
some larger computers.
One byte for character A 01000001
The computer representation in ASCII for the
name Alice is
01000001 A
01001100 L
01001001 I
01000011 C
01000101 E
• To represent the numbers 0 through 9 and
the letters a through z and A through Z,
computer designers have created coding
systems consisting of several hundred
standard codes.
• In one code, for instance, the binary
number 01000001 stands for the letter A.
Numbering System
Counting system
 There are three kinds of people in the world:
those who can count, and those who can not.
- Unknown Wisdom
 Today’s class
 Numbering system
 Conversion between 10 based and 2 based
numbering system.
 Binary Mathematics.
 Quiz
Base 10 counting system
 We happened to us to
be using the current
counting system,
because we happened
to have ten fingers.
 If dinosaurs had ruled
the earth, they would be
happy to use a 8-based
counting system.
Base 2 counting system
Base 8 counting system
Base 16 counting system
Base 10 counting system
Base 10 (Decimal numbers)
 What does 157 mean?
 157 = 1 x 100 + 5 x 10 + 7 x 1
= 1 x 102
+ 5 x 101
+ 7 x 100
Binary Code
 Imagine a specie that only has two fingers.
how can they count?
 A computer is such kind of two-finger
specie. 0 and 1
 Each place is the exponential of 2
Base 10 vs Base 2
Base 10
157
157 = 1 x 100 + 5 x 10 + 7 x 1
= 1 x 102
+ 5 x 101
+ 7 x 100
Base 2
1011 = 1 x 23
+ 0 x 22
+ 1 x 21
+ 1 x 20
1011 = 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1
Base 10 to Binary
Binary mathematics
 0+0=0
 1+0=1
 1+1=10
Hexadecimal (base 16)
 Binary code is too long in representation. Hex
is much shorter.
 Converting a binary number to a Hex number
is relatively easy
 Every 4 bit can convert to a Hex
 Problem: we are short of numbers
 A-10 B-11 C-12 D-13 E-14 F-15
Wisdom said
 There are 10 kinds of people in the world,
those who use binary counting system, and
those who don’t.
Quiz
 No Calculators!!!!
 Convert binary code to Decimal number.
 10110101 (Bin)
 Convert Decimal number to binary code
 186 (Dec)
 Add these two binary numbers
 10101101+11011100=?

Lecture_3_-_Numbering_Systems in computer sciences1].ppt

  • 1.
    Numbering System & ComputerArithmetic John G Kaira
  • 2.
    How Computers RepresentData • All symbols, pictures or words must be reduced to a string of binary digits. • A binary digit is called a bit and represents either a 0 or a 1. • These are the only digits in the binary or base 2, number system used by computers. • A string of eight bits used to store one number or character in a computer system is called a byte (see Figure 0.2).
  • 3.
    • Two commoncoding systems are Extended Binary Coded Decimal Interchange Code (EBCDIC) and American Standard Code for Information Interchange (ASCII). See Table 0.1. • EBCDIC represents every number, alphabetic character, or special character with eight bits, used primarily in IBM and other mainframe computers. • ASCII was originally designed as a seven-bit code, but most computers use eight-bit versions. • ASCII is used in data transmission, PCs and some larger computers.
  • 4.
    One byte forcharacter A 01000001 The computer representation in ASCII for the name Alice is 01000001 A 01001100 L 01001001 I 01000011 C 01000101 E
  • 5.
    • To representthe numbers 0 through 9 and the letters a through z and A through Z, computer designers have created coding systems consisting of several hundred standard codes. • In one code, for instance, the binary number 01000001 stands for the letter A.
  • 6.
  • 7.
    Counting system  Thereare three kinds of people in the world: those who can count, and those who can not. - Unknown Wisdom  Today’s class  Numbering system  Conversion between 10 based and 2 based numbering system.  Binary Mathematics.  Quiz
  • 8.
    Base 10 countingsystem  We happened to us to be using the current counting system, because we happened to have ten fingers.  If dinosaurs had ruled the earth, they would be happy to use a 8-based counting system.
  • 9.
    Base 2 countingsystem Base 8 counting system Base 16 counting system Base 10 counting system
  • 10.
    Base 10 (Decimalnumbers)  What does 157 mean?  157 = 1 x 100 + 5 x 10 + 7 x 1 = 1 x 102 + 5 x 101 + 7 x 100
  • 11.
    Binary Code  Imaginea specie that only has two fingers. how can they count?  A computer is such kind of two-finger specie. 0 and 1  Each place is the exponential of 2
  • 12.
    Base 10 vsBase 2 Base 10 157 157 = 1 x 100 + 5 x 10 + 7 x 1 = 1 x 102 + 5 x 101 + 7 x 100 Base 2 1011 = 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 1011 = 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1
  • 15.
    Base 10 toBinary
  • 16.
  • 17.
    Hexadecimal (base 16) Binary code is too long in representation. Hex is much shorter.  Converting a binary number to a Hex number is relatively easy  Every 4 bit can convert to a Hex  Problem: we are short of numbers  A-10 B-11 C-12 D-13 E-14 F-15
  • 18.
    Wisdom said  Thereare 10 kinds of people in the world, those who use binary counting system, and those who don’t.
  • 19.
    Quiz  No Calculators!!!! Convert binary code to Decimal number.  10110101 (Bin)  Convert Decimal number to binary code  186 (Dec)  Add these two binary numbers  10101101+11011100=?