Feb 12
I didn't post the homework until late,
and didn't get to look at the datalab
last Thur ... so I've set the homework
due date for Thursday. (However, I will
move back to Tue the following week.)
This week we'll finish the chapter 2 material,
and start chapter 3 (reading assembly language)
next week. If you want a head start on that, dive in.
Read pg 99 - 119 on floating point for Thursday
if you haven't already.
signed integers and overflow
Discuss the code I posted in last Thursday's notes.
datalab
Take a look in class at the
datalab
and how to run it, also described in those notes.
Floating point
If time allows, start looking at the floating point material.
First idea: binary numbers to the right of the decimal.
101.1101_base2 = ?
So what is 1/10 in this binary decimal system?
(This is not base 10 ... so not exact for typical scientific notation.)
IEEE 754 floating-point standard
\[ Value = (-1)^s (M) (2^E) \]
s = sign (1 bit)
E = exponent = e - bias (normalized)
OR = 1 - bias (denormalized, e=0)
bias = 2**(k-1) - 1
e has k bits
M = fractional binary number = 1 + f
f = frac stored in bits ; 1 > f >= 0; (f has n bits)
called "implied leading 0"
- single precision: k = 8 , n = 23 ; 1 + 8 + 23 = 32bits
- double precision: k = 11 , n = 52 ; 1 + 11 + 52 = 64bits
4 cases:
- normalized : E is not all 0 or all 1.
- denormalized
- INF
- NAN
Work through figure 2.33 & 2.34. (The best way to understand this is to work through some examples.)
hypothetical 6 bit float
- s has 1 bit, exponent has k = 3, frac has n = 2
- 1 + 3 + 2 = 6 bits total
hypothetical 8 bit float
- s has 1 bit, exponent has k = 4 bits, frac has n = 3 bits
- 1 + 4 + 3 = 8 bits total
The "denormalized" part allows for a smooth underflow transition,
and the different definitions of the exponent give the denormalized
the same as the minimum normalized exponent.