CPS120:%20Introduction%20to%20Computer%20Science - PowerPoint PPT Presentation

About This Presentation
Title:

CPS120:%20Introduction%20to%20Computer%20Science

Description:

... Continue the process until you add the last digit CPS120: Introduction to Computer Science ... 3 3 011 2 2 010 1 1 001 0 0 000 ... 6 x 8 = 6 x 64 ... – PowerPoint PPT presentation

Number of Views:102
Avg rating:3.0/5.0
Slides: 13
Provided by: wcc58
Learn more at: http://space.wccnet.edu
Category:

less

Transcript and Presenter's Notes

Title: CPS120:%20Introduction%20to%20Computer%20Science


1
CPS120 Introduction to Computer Science
  • Computer Math Converting to Decimal

2
Binary
Decimal is base 10 and has 10 digits
0,1,2,3,4,5,6,7,8,9 Binary is base 2 and has 2
digits 0,1
For a number to exist in a given number system,
the number system must include those digits. For
example The number 284 only exists in base 9 and
higher.
9
3
Codes
  • Given any positive integer base (RADIX) N, there
    are N different individual symbols that can be
    used to write numbers in the system. The value of
    these symbols range from 0 to N-1
  • All systems we use in computing are positional
    systems
  • 495 400 90 5

4
Number Systems
  • We use the DECIMAL (10 system
  • Computers use BINARY (2 or some shorthand for it
    like OCTAL (8 or HEXADECIMAL (16

5
Power of 2 Number System

Binary Octal Decimal
000 0 0
001 1 1
010 2 2
011 3 3
100 4 4
101 5 5
110 6 6
111 7 7
100 10 8
1001 11 9
1010 12 10
16
6
Bases Higher than 10
How are digits in bases higher than 10
represented?
Base 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F
10
7
Conversions
8
Decimal Equivalents
  • Assuming the bits are unsigned, the decimal value
    represented by the bits of a byte can be
    calculated as follows
  • Number the bits beginning on the right using
    superscripts beginning with 0 and increasing as
    you move left
  • Note 20, by definition is 1
  • Use each superscript as an exponent of a power of
    2
  • Multiply the value of each bit by its
    corresponding power of 2
  • Add the products obtained

9
Converting Octal to Decimal
What is the decimal equivalent of the octal
number 642?
6 x 8² 6 x 64 384 4 x 8¹
4 x 8 32 2 x 8º 2 x 1
2 418 in base 10
11
10
Converting Hexadecimal to Decimal
What is the decimal equivalent of the hexadecimal
number DEF?
D x 16² 13 x 256 3328 E x 16¹
14 x 16 224 F x 16º 15 x 1
15 3567 in base 10
Remember, base 16 is 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E
,F
11
Converting Binary to Decimal
What is the decimal equivalent of the binary
number 010110?
1 x 26 1 x 64 64 1 x 25 1
x 32 32 0 x 24 0 x 16 0 1
x 23 1 x 8 8 1 x 22 1 x 4
4 1 x 21 1 x 2 2 0 x 2º
0 x 1 0 112 in base 10
13
12
Horners Method
  • Another procedure to calculate the decimal
    equivalent of a binary number
  • Note This method works with any base
  • Horners Method
  • Step 1 Start with the first digit on the left
  • Step 2 Multiply it by the base
  • Step 3 Add the next digit
  • Step 4 Multiply the sum by the base
  • Step 5 Continue the process until you add the
    last digit
Write a Comment
User Comments (0)
About PowerShow.com