Logical Operations
- Shift operations
-
Left Shift throw away extra bits on left, fill with 0’s on the right -
Right Shift throw away extra bits on right logical shift: fill with 0’s on the left arithmetic shift: replicate most significant bit(x >> k gives
?
x
/
2
k
?
\lfloor x/2^k \rfloor
?x/2k? towards negative infinity)
Floating Point Representation
Biased Representation
The actual value is the binary value plus a fixed bias
Definition
(
?
1
)
s
×
(
1
+
F
)
×
2
E
(-1)^s\times(1+F)\times2^E
(?1)s×(1+F)×2E
- S represents Sign
- 1 for negative, 0 for positive
- Significand
- implicit leading 1, signed-magnitude (not 2’s complement)
- y’s represent Exponent
Special Cases
Exponent(Biased) | Significand | Object |
---|
0 | 0 | 0 | 0 | nonzero | Denorm | 1-254 | aynthing | Normal Floating Point | 255 | 0 | Infinity | 255 | Nonzero | NaN |
Overflow and Underflow
-
Overflow (
>
2.0
×
1
0
38
>2.0\times10^{38}
>2.0×1038or
<
?
2.0
×
1
0
38
<-2.0\times10^{38}
<?2.0×1038) -
Underflow (
?
2.0
×
1
0
38
<
x
<
2.0
×
1
0
38
-2.0\times10^{38}<x<2.0\times10^{38}
?2.0×1038<x<2.0×1038 without 0)
0,
∞
\infty
∞ and NAN
op(NaN, X) = NaN
Demorms
Denormalized number:
- no (implied) leading 1(just
F
F
F),frac nonzero
- exponent all 0,value = 1 – Bias (instead of 0 – Bias)
|