Floating Point Numbers - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Floating Point Numbers

Description:

As an unsigned integer the above would be 3648499417 in decimal. 1 ... Sometimes informally referred to as the mantissa. Significand. Exponent. Sign. 1. 1. 0. 1 ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 14
Provided by: josepheg
Category:

less

Transcript and Presenter's Notes

Title: Floating Point Numbers


1
Floating Point Numbers
  • CS2 Lab7

2
Binary Numbers
  • Binary Numbers (base 2).
  • 1 Byte 8 Bits
  • As an unsigned integer the above would be
    3648499417 in decimal
  • 1 0 0 8 16 0 .

3
IEEE Floating Point Numbers
  • An approximation of the rational numbers.
  • Think of it as scientific notation in base 2
  • (sign) (significand) 2(exponent constant bias)
  • For example

4
A Bit of Details
  • Sign(31)
  • (0? and 1? -)
  • Exponent (30 - 23)
  • A number between 0 and 255 inclusive
  • Biased by -127
  • Significand (22-0)
  • Sometimes informally referred to as the mantissa

5
Normalized Form
  • In scientific notation we can write
  • 31.410-1
  • 3.14100 (Normal Form)
  • 0.314101
  • 0.0314102
  • Floating Point Numbers
  • A floating point is said to be in normal form if
    the first digit in the significand is 1
  • 0.10101 ? 1.01012-1

6
A Bit of Math
Sign -1
Exponent 0(20) 1(21) 0(22) 0(23) 1(24)
1(25) 0(26) 1(27) Exponent 178
(sign) (significand) 2(exponent constant
bias) (-1) (16232153 / 8388608 ) 2(178
127) (-1) (16232153 / 8388608 ) 251 4.37529 x
1015 And you thought it would be p?
Significand 1 1(2-1) 1(2-2) 1(2-3)
0(2-4) 1(2-5) Significand 16232153 /
8388608 1.9350234270095825
7
Air Hockey
8
Hitting the Wall
9
(No Transcript)
10
(No Transcript)
11
(No Transcript)
12
(No Transcript)
13
Working With the Air Hockey Frame Work
  • Based on MissileCommand Frame Work
  • GameController (The Main Class)
  • If you want to play the game in full screen mode
    modify the main method of this class changing
    new GameDisplay(false) ? new GameDisplay(true)
  • GameLogic (What Will Modify)
  • GameState (The State of The Game)
  • GameDisplay (Renders The Game)
Write a Comment
User Comments (0)
About PowerShow.com