Ive got problems with big hairy gorillas on them. PowerPoint PPT Presentation

presentation player overlay
1 / 23
About This Presentation
Transcript and Presenter's Notes

Title: Ive got problems with big hairy gorillas on them.


1
Ive got problems with big hairy gorillas on
them.
http//www.imdb.com/title//
  • Gedde Watanabe in Gung Ho (1986)

2
Computer Science 101Lecture 7
www.pjrc.com/tech/ 8051/board5/schematic.gif
  • Spring Semester 2008
  • Friday, January 25
  • Week 3/18
  • Albert H. Carlson

3
Announcements
  • HW 1 is due today, January 25
  • HW 2 is due on Friday, February 8

4
What Do We Do for Fractions?
  • Normally, we show where the whole number ends
    and the fraction begins
  • This is normally shown by a .
  • 785.25
  • What do we call this dot?
  • We call it the radix point
  • Everything to the right of the point is fractional

5
  • Since the number to the left of the radix is 100,
    then it only makes sense that the number to the
    right is 10-1
  • 10-1 1/10 1/101 .1
  • And, it just keeps going using the same logic

6
So, What Bases Are There
  • As many as you can imagine
  • Only a few have proven useful over time. They
    include
  • Base 2 (Binary)
  • Base 8 (Octal)
  • Base 10 (Decimal)
  • Base 12 (No name, but based on dozens)
  • Base 16 (Hexadecimal)

7
What Can We Say About Them
  • For a base n, there are n symbols 0 up to n-1
  • Note, for base 3, for instance, there can be NO 3
    in the number
  • Hexadecimal, or hex, has a problem we have no
    symbols for 10 through 16. We use a, b, c, d, e,
    f
  • Denote bases by a subscript of the base after the
    number - 3458

8
  • Some bases are special and have different
    notation
  • NO base indication for base 10 it is the
    default
  • Use an H to denote hexadecimal 2a5H

9
Numbers are a Language
  • Numbers are a language just like combinations
    of letters
  • The symbols are numbers the numbers are the set
    of symbols
  • Lets say we have a cow. We will look at how
    different people say cow

10
  • Cow (English)
  • ?????? (Russian word)
  • ??? (Russian has the same rough sound)
  • Note that in both languages we are saying the
    same thing
  • The second one is just the same sound in a
    different language.

11
  • In effect, we are saying the same thing, but in
    order to understand it, we have to translate it
    into what we know
  • Base conversion does that translation
  • No matter what language we say it in, it means
    the same thing

12
How Do We Do Math?
  • The simple answer is Generally the same way
  • Lets use base 2 for example
  • In base two we have 2 numbers
  • 0
  • 1
  • We are going to do the four basic math operations

13
  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Lets start with addition
  • Basic Facts
  • 0 0 0
  • 0 1 1 0 1
  • 1 1 102
  • 1 1 1 112

14
Back to the Math
  • It is not really different than what you are used
    to
  • Lets do a simple example
  • 111102 000112
  • So, how do we start?
  • We start by getting the problem set up like we
    normally do with addition

15
1
1
1
1
11110 00011
1
0
0
0
0
1
16
Practice Problems
101010 110011 1011101
111011 000101 1000000
17
Subtraction
  • Rules are simple
  • 0 0 0
  • 1 1 0
  • 1 0 1
  • 0 1 1, borrow the 1, or 102 1 1, borrow
    the 1
  • The key is the borrow

18
Doing the Subtraction
  • An Example
  • 11110
  • -00001

1
0
\
1
0
1
1
1
19
  • Another Example
  • 10000
  • -00010
  • 01110
  • 101010
  • -010101
  • 010101

20
Multiplication
  • Again, multiplication looks a lot like decimal
    multiplication
  • Here the terms are a lot easier
  • 1 0 0 1 0 0 0
  • 1 1 1
  • The steps are the same
  • Multiply by the number in question
  • Write down the answer
  • Shift left, and repeat until done

21
  • An example
  • 1010
  • x0101

1010
0000
1010
0000
0110010
22
Practice Problems
  • 1111
  • x1000
  • 1111000
  • 0110
  • x1001
  • 110110

23
Questions?
Write a Comment
User Comments (0)
About PowerShow.com