Fixed Point and Floating Point Representation #2
Fixed Point and Floating Point Representation #2
Representations of numbers
Unsigned integers Signed integers 1s and 2s complement representation To represent
Very Large and very Small numbers Real numbers in general
1999.10
19.9910
1001.2
Fixed-point representation
Uses the two numbers from 0 to 1 Every column represents a power of 2
Twos (21) column Ones (20) column Halves (2-1) column Fourths (2-2) column
10.012
Addition
Base-10 Base-2
1. 1. 2.
2 5 7
5 0 5
+ 1
1. 1. 0.
0 1 1
1 0 1
= 19.99 x 10 = 199.9 x 10
10
12
Improvements
Bias the exponent
Always subtract a fixed amount, e.g., 3 Allows representation of negative exponents
Implicit one
- Leading one in a Phone number such as 1-619-556-0231 is redundant. Why use a bit for the leading one?
14
Double precision
64 bits
sign: 1 bit exponent: 11 bits significand: 52 bits
Bias: 127
Bias: 511
16
17
18
exponent
mantissa
3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
exponent
mantissa
3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
19