1 / 12

15-213 Recitation

15-213 Recitation. 8/28/08 Jackson Davis (Material blatantly stolen from lecture slides). Floating Points and You. (or, Float Points, you, and datalab). +  0x7F800000 NAN Lots of values (fraction anything but 0) But the questions require 0x7FC00000 And they will remind you other this

cmeghan
Télécharger la présentation

15-213 Recitation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 15-213 Recitation 8/28/08 Jackson Davis (Material blatantly stolen from lecture slides)

  2. Floating Points and You (or, Float Points, you, and datalab) • +  • 0x7F800000 • NAN • Lots of values (fraction anything but 0) • But the questions require 0x7FC00000 • And they will remind you other this • Fraction mask (how many bits are those?) • 0x007FFFFF • Exponent mask (how many bits are these?) • 0x7F800000

  3. Aside • Book is mostly awesome • But Not Always (see multi-level vm) • Wikipedia is also awesome • Especially Here • Funny Standard Name-IEEE 754 • Double arrow bullets!

  4. Those Denormalized Things(and why they exist) • Smallest Normalized Value • 0x00800000 • 2^-126  1.18*10^-38 • Largest Denormalized Value • 0x007FFFFF • 0.high (1-2^-26) * 2^-126 1.18*10^-38 • But not the same 1.18*10^-38

  5. They Get Smaller! • Smallest Denormalized Value • 0x0000001 • 0.(small, 2^-23) * 2^-126 = 2^-149 = 1.40*10^-45

  6. A Smaller Example (aka why sign bits make conversion to hex ugly and why my 21-355 homework sucks) • 8 Bits – 4 for Exponent, 4 for Fraction • Bias is??? (drumroll) • 7 (2^(4-1)-1) • Everything is positive • Because things are more happy

  7. Yet Another Normalized Slide (YANS) • Smallest Normalized • 0x10 – 1.0*2^-6 =1/64 • Largest Denormalized • 0x0F 0.15/16 *2^-6 =15/1024 (1/64-1/1024) • Smallest Denormalized • 0x01 0.1/16*2^-6 =1/1024 • Don’t leave him out-Largest Normalized? • 0xEF 1.15/16*2^7 =248

  8. Rounding is fun too (Except when its super confusing-see below) • The only one you need to know • Round to Even • What??? • Goes to nearest number, except when in the middle • Then you go to the nearest even, either + or –

  9. More Practice Time • Round to the nearest integer • 1.5 • 2 • 2.5 • 2 • -1.5 • -2 • -2.5 • -2

  10. How it applies to The Thing Due on Monday • You will be dividing by 2 • And rounding correctly  • Some binary number is being divided by 2 • But its the fraction part of a normalized floating point! • Bit shifts are fun here

  11. How it works • Right of the |->getting cut off by shift • blabla0|0 (nice and easy to start) • blabla0 • blabla0|1 • blabla0 (go even) • blabla1|0 • blabla1 (what rounding?) • blabla1|1 • Blabla1 + 1 (blablb?) • What Bit Operations might be nice here?

  12. Sometimes, we chop off more than 1 bit (this super-shamelessly stolen from the lecture slides) • Cutting to 2 decimal places • 2 2/32 10.00011-> • 10.00 2 • 2 3/16 10.00110-> • 10.01 2 ¼ • 2 7/8 10.11100 • 11.00 3 • 2 5/8 10.10100 • 10.10 2 1/2

More Related