Lecture Slides 02 026-IEEEfloats
Lecture Slides 02 026-IEEEfloats
Representation in memory:
MSB s is sign bit s
exp field encodes E (but is not equal to E)
frac field encodes M (but is not equal to M)
s exp frac
Precisions
Single precision: 32 bits
s exp frac
1 k=8 n=23
Special values:
The bit pattern 00...0 represents zero
If exp == 11...1 and frac == 00...0, it represents
e.g. 1.0/0.0 = 1.0/0.0 = +, 1.0/0.0 = 1.0/0.0 =
If exp == 11...1 and frac != 00...0, it represents NaN: “Not a Number”
Results from operations with undefined result,
e.g. sqrt(–1), ,*0
Normalized Values
s
V = (–1) * M * 2
E s exp frac
k n
Condition: exp 000…0 and exp 111…1
Exponent coded as biased value: E = exp - Bias
exp is an unsigned value ranging from 1 to 2k-2 (k == # bits in exp)
Bias = 2k-1 - 1
Single precision: 127 (so exp: 1…254, E: -126…127)
Double precision: 1023 (so exp: 1…2046, E: -1022…1023)
These enable negative values for E, for representing very small values
Result:
0 10001100 10000001110010000000000
s exp frac