Professional Documents
Culture Documents
Fixed Floating
Fixed Floating
floating-point numbers
CS370
Fall 2003
Representations of numbers
Unsigned integers
Signed integers 1s and 2s
complement representation
To represent
Very Large and very Small numbers
Real numbers in general
Fixed-point numbers
Floating-point numbers
2
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
1.
1.
2.
2
5
7
Base-2
5
0
5
+
1
1.
1.
0.
0
1
1
1
0
1
Min
Step
0
1
0
.5
0 .25
0 .0625
Max
Value of
00110001
255
127.5
63.75
15.9375
= 19.99 x 10
= 199.9 x 10
10
12
number
base 10
001
1001
1.001x21 2.25
011
1100
1.1 x 23
111
1110
1.11 x 27 224.0
001
1110
12.0
13
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
significand
4 bits
0010
1000
1100
1100
Bias: 127
Double precision
64 bits
sign: 1 bit
exponent: 11 bits
significand: 52 bits
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