Computer Science 1 Cheryl Dugas, PhD cadcs'rit'edu Bases - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

Computer Science 1 Cheryl Dugas, PhD cadcs'rit'edu Bases

Description:

10/22/09. CS1s - 02A-Primitive Types & Expressions (v2.00) 1. Computer Science 1 ... 5. Why do computer scientists get Halloween and Christmas mixed up? ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 6
Provided by: seR9
Category:

less

Transcript and Presenter's Notes

Title: Computer Science 1 Cheryl Dugas, PhD cadcs'rit'edu Bases


1
Computer Science 1Cheryl Dugas, PhD
cad_at_cs.rit.eduBases
Haiku Cool to know although Not the same as
All your base are belong to us.
2
Number Bases
  • The most commonly used bases for numbers in
    computer science are
  • Binary (base 2)
  • Alphabet 0 1
  • Example 10012, 01102, 02, 12
  • Octal (base 8)
  • Alphabet 0 1 2 4 5 6 7
  • Example 78, 08, 4608
  • Decimal (base 10)
  • Alphabet 0 1 2 3 4 5 6 7 8 9
  • Example 10010, 010, 200410
  • Hexadecimal (base 16)
  • Alphabet 0 1 2 3 4 5 6 7 8 9 A B C D E F
  • Example 916, 016, ACDC16, DEADBEEF16

3
Converting Number Bases to Decimal
  • Consider the number 1810
  • 1 101 8 100 1810
  • Consider the number 100102
  • 1 24 1 21 1810
  • Consider the number 1216
  • 1 161 2 160 1810

8
1
100
101
1
0
0
1
0
24
23
22
21
20
2
1
161
160
4
Converting Decimal Numbers to Binary
  • Consider the number 2710
  • 201, 212, 224, 238, 2416, 2532
  • Continually subtract the largest possible amount
    and place a 1 in the appropriate bit field
  • 25 (0) too large
  • 24 (1) ok, new value is 27-1611
  • 23 (1) ok, new value is 11-83
  • 22 (0) too large
  • 21 (1) ok, new value is 3-21
  • 20 (1) ok, new value is 1-10
  • 2710 110112

5
  • Why do computer scientists get Halloween and
    Christmas mixed up?
Write a Comment
User Comments (0)
About PowerShow.com