SLIDE 1
Thursday, 22 November 2015 Please respond to the survey (see email)! - - PowerPoint PPT Presentation
Thursday, 22 November 2015 Please respond to the survey (see email)! - - PowerPoint PPT Presentation
Thursday, 22 November 2015 Please respond to the survey (see email)! Gator Day: Tues., Nov. 27--BE THERE! 11 a.m. -- student presentations noon -- lunch Today: floating point For next week: keep reading chapter 3 Floating Point How do we
SLIDE 2
SLIDE 3
Floating Point
The same pattern continues to the right of the decimal point (“binary point”?): 1001011.01101 0x2-1 + 1x2-2 + 1x2-3 + 0x2-4 +1x2-5
=
0 + .25 + .125 + 0 + .03125 The entire thing, in decimal, is 75.40625.
High school algebra: 2-k = 1
2k
SLIDE 4
Decimal Fraction to Binary Fraction
To convert a decimal integer to binary, we repeatedly divided by 2 and took remainders (see notes from 17 September). To convert a decimal fraction to binary, we repeatedly multiply and take (whole number) product. Thus, .01101 .40625 x 2 = 0.81250 (product = 0) .8125 x 2 = 1.625 (product = 1) .625 x 2 = 1.25 (product = 1) .25 x 2 = 0.5 (product = 0) .5 x 2 = 1.0 (product = 1)
SLIDE 5
Decimal to Binary Example
Let’s put it all together into a single example. Convert 3.675: 3 % 2 = 1 (3/2=)1 % 2 = 1 11.101 .675 x 2 = 1.25 (product = 1) .25 x 2 = 0.5 (product = 0) .5 x 2 = 1.0 (product = 1)
SLIDE 6
Scientific Notation
From your high school science courses you probably are familiar with “scientific notation”: 388291.83 = 3.8829183 x 105 0.0003228 = 3.228 x 10-4 3.14159 = 3.14159 x 100 We’ve used it already in this class, e.g., a nanosecond is .000000001 sec = 1x10-9 sec, a megabyte is 1000000 bytes = 1x106 bytes.
SLIDE 7
Floating Point
Floating point is just scientific notation, but in binary rather than decimal. Thus, 10110.10011 = 1.011010011 x 24 0.0001011 = 1.011 x 2-4 1.11001 = 1.11001 x 20 NOTE: You CAN NOT just translate the base 10 scientific notation into binary floating point! 5.5 x 100 is not 101.1 x 20, but 1.011 x 22
SLIDE 8
Floating Point
Precision is the number of significant bits (or significant decimal digits--definitions vary) in a floating point number. Many fractions that have finite decimal representations have infinitely- long binary representations, so we can keep
- nly a limited number of bits.
One-tenth (0.1ten) is such a number: 0.1ten = .00011001100110011001100… two
SLIDE 9
32-bit Floating Point
- 17ten = 1.0001 x 24
1 1 1 1 1
... sign (1 bit) exponent + 127 (8 bits) fraction (23 bits) Leading “1” bit is never included 4 + 127 = 10000011
SLIDE 10