Introduction to Introduction to Computer Science (huh???) - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Introduction to Introduction to Computer Science (huh???)

Description:

Introduction to Introduction to Computer Science (huh???) A very introductory crash course ... Will attempt to cover as many 1st year Computer Science topics as ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 11
Provided by: me6122
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Introduction to Computer Science (huh???)


1
Introduction to Introduction to Computer Science
(huh???)
  • A very introductory crash course
  • Will attempt to cover as many 1st year Computer
    Science topics as possible in 3-4 sessions.
  • Topics may include
  • Number Representation
  • Data Types, Data Structures
  • Basic Computer Architecture
  • Elementary Searching and Sorting Algorithms

2
Text Books
  • Far too many to list
  • The BII library is a good source
  • The Internet is another
  • Try the Idiots series also

3
The Binary System(do we need to go through this?)
  • To convert binary to base 10
  • For any binary number bn-1bn-2b1b0,
  • X bn-1?2n-1 bn-2 ?2n-2b1?2b0
  • To convert base 10 to binary
  • Divide by 2, note remainder
  • Keep dividing and noting remainders until
    result0
  • Binary value is the whole series of remainders
    read backwards

4
Word Length
  • Myth 64-bit computers are 232 times more
    powerful than 32-bit computers
  • Word length refers to the size of CPU registers,
    not processing power
  • Affects
  • Size of largest integer the computer can directly
    handle
  • Amount of directly accessible memory
  • Eg. a 32-bit PCs largest signed integer is
    214743647 (231-1) and the largest directly
    accessible memory segment is 4GB.

5
2s Complement
  • How to represent negative numbers?
  • Consider WLOG an 8-bit word
  • If the MSB is 0, ve number
  • If MSB is 1, the value is
  • - ((b7b6b5b4b3b2b1b0 XOR 11111111) 1)
  • E.g.
  • 00101101 45
  • 11010011 -45

6
Binary Arithmetic
4562107 4562107 4562107 4995144 4995144 4995144 80-7380 -73 7 80-7380 -73 7
00101101 00101101 00101101 00110001 00110001 00110001 01010000 01010000
00111110 00111110 01011111 01011111 01011111 01011111 10110111 10110111 10110111
01101011 10010000 -112? -112? 100000111
(overflow) (overflow) (overflow) (overflow)
43-5643 -56 -13 43-5643 -56 -13 43-5643 -56 -13 -65-96-161 -65-96-161 -65-96-161
00101011 00101011 10111111 10111111 10111111
11001000 11001000 11001000 10100000 10100000 10100000 10100000
11110011 101011111 101011111 95? 95?
(underflow) (underflow) (underflow) (underflow)
Carry in
Carry out
  • For correct results either (both carry in and
    carry out) or (no carries)

7
Multiplication and Division
  • Multiplication
  • Long multiplication possible
  • Faster algorithms exist
  • Refer to the book by Hennesey and Patterson for
    details
  • Division
  • So complicated that some systems implement as
    software routine
  • Hennesey and Patterson for details

8
Floating Point Numbers
  • IEEE 754 the de-facto standard today
  • Single Precision

31
30
0
22
23
Significand
Exponent
Assumed decimal point
Sign bit
  • Double Precision

63
62
0
51
52
Significand
Exponent
9
IEEE 754
  • Normally
  • Sign bit is 0 for ve and 1 for ve
  • Significand is assumed to be 1.xxxxxx
  • Exponent is read as 2k-7 (SP) or 2k-10 (DP)
  • Read the number as ?1.Significand ? 2Exponent 7
    (SP) or 10 (DP)
  • Otherwise, exceptions as per the table below

Type Sign Exponent Assumed bit Significand
NaN ? 111111 1 1xxx...xxx
SNaN ? 111111 1 0xxxxxx
Infinity ? 111111 1 0
Denormalised ? 0 0 xxxxxx
Zero ? 0 0 0
10
Floating Point Arithmetic
  • Addition/Subtraction
  • Denormalise smaller number if necessary so that
    both exponents are the same
  • Add/subtract significands
  • Normalise if necessary
  • Multiplication/Division
  • Multiply/divide significands
  • Add/subtract exponents
  • Normalise if necessary
Write a Comment
User Comments (0)
About PowerShow.com