1 / 7

Recitation 5: Exam 1 Review

Join Andrew Faulring's Exam 1 Review session covering Floating Point and Unions. Learn about s.exp.frac, normalized vs. denormalized numbers, and practice problems on two’s-complement, array index, and struct layout with unions.

dmcwilliams
Download Presentation

Recitation 5: Exam 1 Review

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. Recitation 5:Exam 1 Review Andrew Faulring 15213 Section A 7 October 2002

  2. Andrew Faulring • faulring@cs.cmu.edu • Office hours: • NSH 2504 (lab) / 2507 (conference room) • Tuesday 4–5 • Lab 3: due Monday (7 Oct), 11:59pm • Lab 4: later this week (probably by Thursday) • Exam 1: Tuesday (8 Oct), 6:00–7:30pm Doherty Hall 2315

  3. Today’s Plan • Exam 1 review • Problems from last fall’s exam 1 • Floating Point • Unions

  4. Floating Point s exp frac • s: sign bit • exp: encodes E (m bits) • value unbiased • bias = 2m−1 − 1 • frac: fractional number (n bits) • Normalized: [1.0, 2.0) • exp ≠ 0…0 & exp ≠ 1…1 • Denormalized: [0.0, 1.0) • exp = 0…0

  5. Example: exp with 3 bits exp exp E 2E 0 000 −2 ¼ (denorms) 1 001 −2 ¼ 2 010 −1 ½ 3 011 0 1 4 100 1 2 5 101 2 4 6 110 3 8 7 111 n/a (inf, n/a)

  6. Practice Problems • #2 floating point • #1 two’s-complement • #5 array index • #7 struct layout (with unions)

  7. #7 changes typedef union { OldSensorData oldData; NewSensorData newData; } SensorDataUnion;

More Related