Beruflich Dokumente
Kultur Dokumente
d n 1
d 2 d1d 0 = d n 1b n 1 +
+ d 2b 2 + d1b1 + d 0b 0
4.2
x10 = d n 1
d 2 d1d 0 = d n 1b n 1 +
+ d 2b 2 + d1b1 + d 0b 0
4.3
29710
Base 2: Base 8: Base 16:
4.5
82
81
80
From binary to hexadecimal: Each group of four digits gives a hexadecimal digit.
2 7 26 25 2 4 23 2 2 2120 161
160
4.6
Exercise
29710 = 1001010012
2978 = 29716 =
Remember that padding a number with 0s on the left does not change the value it represents.
4.7
Integer Representation
(1) Signed magnitude
rep( x) = 0 bin( x) if 2 n-1 > x 0 1 bin( x ) if -2 n-1 < x < 0
(2) 1s Complement
rep( x) = bin( x) if 2 n-1 > x 0 bin((2 n 1) x ) if -2 n-1 < x < 0
(3) 2s Complement
rep( x) = bin( x) if 2 n-1 > x 0 bin( 2 n x ) if -2 n-1 < x < 0
4.8
Integer Representation
(4) Excess (or biased)
First, define a bias B, a value that when added to the number youre going to represent results in a nonnegative number less than 2 n (n is the number of bits you have in your representation).
Binary
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Unsigned integer
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Signed Magnitude
+0 +1 +2 +3 +4 +5 +6 +7 -0 -1 -2 -3 -4 -5 -6 -7
1s complement
0 1 2 3 4 5 6 7 -7 -6 -5 -4 -3 -2 -1 0
2s complement
0 1 2 3 4 5 6 7 -8 -7 -6 -5 -4 -3 -2 -1
Biased
4.10
10
Operations on Integers
A non-exhaustive list
4.11
11
Operations on 2s Complement
Absolute value: Look at the leftmost bit, if 0,
youre done, if 1, you have to compute its 2s complement.
12
A B
Sum
CarryOut
4.13
13
A B
+
CarryIn
Sum
CarryOut
b CarryOut
4.14
14