Number Representation
How do we represent the Significand and Exponent?
(32-bit IEEE standard)
Exponent
- Have 8 bits available (256 values),
need to represent positive and negative exponents
(ideally -127 – 128, not -128 – 127).
- Could use sign & magnitude, one's complement, or two's
complement
BUT we want negative exponents to look smaller
than positive exponents
Significand
0 is a special case
- Cannot be represented as described above (has no normal form).
Represent as all 0's.
31 |
30 23 |
22
0 |
0 |
00000000 |
0000000000000000... |
↑ |
↑ |
↑ |
sign |
exp |
significand |
|
(8 bits) |
(23 bits) |
- Advantages: Very quick tests for
<0
, 0
,
>0
(S == 1, all zeros, S == 0 but not all zeros)
- Disadvantage: Lose ability to represent
2-127 — small loss!
Examples
45.510 = 101101.12 = 1.011011 * 25
31 |
30 23 |
22
0 |
0 |
10000100 |
0110110000000000... |
1/8 = 0.0012 = 1.000 * 2-3
31 |
30 23 |
22
0 |
0 |
01111100 |
0000000000000000... |
Your turn: 34 1/4 = ?
Trick Question: 1/10 = ?
64-bit word
- Same as for 32-bit word, except
both exponent and significand have more bits
and
exp = E + 1023
.
63 |
62 52 |
51
0 |
S |
Exp |
Significand |
↑ |
↑ |
↑ |
sign |
exp |
significand |
|
(11 bits) |
(52 bits) |
Alyce Brady, Kalamazoo College