Week 05 Notes for CST8281 - Fall 2011

Ian! D. Allen - idallen@idallen.ca - www.idallen.com

Fall 2011 - September to December 2011 - Updated 2020-11-12 14:48 EST

1 Midterm Test #1 - 15%Indexup to index

2 Lecture Notes for This WeekIndexup to index

2.2 From Blackboard Course DocumentsIndexup to index

These documents have restricted distribution and cannot be put on the Course Home Page.

2.3 From the InternetIndexup to index

2.4 From the Classroom Whiteboard/ChalkboardIndexup to index

2.4.1 Floating PointIndexup to index

  • Review last week. Look at the 1/10 example program.

  • IEEE754 Single Precision: one bit sign, eight bits exponent, 23+1 bits of significand (mantissa). (The leftmost “1.” bit is assumed.)

  • Write 1.0 decimal as normalized binary: +1.0 * 2^0

    • sign: +
    • exponent of 2: 0
    • mantissa/significand: 1.0
    • as IEEE754 S.P. in binary?
      • 8-bit exponent 0 goes in as excess-127, so 0+127 = 127 = 01111111(2)
      • Answer: 0 01111111 00000000000000000000000(2)
    • What is the next IEEE754 S.P number greater than 1.0?
      • Smallest change to significand is from 00000000000000000000000 to 000000000000000000000001 or 2^-23
      • multiply by exponent 2^0: 2^-23 * 2^0 = 2^-23
      • next number is 1.0 + 2^-23
  • Write 8388608 decimal as normalized binary: +1.0 * 2^23

    • sign: +
    • exponent of 2: 23
    • mantissa/significand: 1.0
    • As IEEE754 S.P. in binary?
      • 8-bit exponent 23 goes in as excess-127, so 23+127 = 150 = 10010110(2)
      • Answer: 0 10010110 00000000000000000000000(2)
    • What is the next IEEE754 S.P number greater than 8388608?
      • Smallest change to significand is from 00000000000000000000000 to 000000000000000000000001 or 2^-23
      • multiply by exponent 2^23: 2^-23 * 2^23 = 2^0 = 1
      • next number is 8388608 + 1 = 8388609
  • See the 02.ppt slide set, but don’t read all the slides.

  • Coming up next: Character data

Author: 
| Ian! D. Allen  -  idallen@idallen.ca  -  Ottawa, Ontario, Canada
| Home Page: http://idallen.com/   Contact Improv: http://contactimprov.ca/
| College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/
| Defend digital freedom:  http://eff.org/  and have fun:  http://fools.ca/

Plain Text - plain text version of this page in Pandoc Markdown format

Campaign for non-browser-specific HTML   Valid XHTML 1.0 Transitional   Valid CSS!   Creative Commons by nc sa 3.0   Hacker Ideals Emblem   Author Ian! D. Allen