Professional Documents
Culture Documents
Integer Representation
Integer Representation
Representation
of Integer Numbers
in Computer Systems
Positional Numbering System
Computer Architecture, IFE Computer Science, 4sem
ρ=0 ρ≥1
Generalized
Non-redundant signed-digit (GSD)
ρ=1 ρ≥2
α=0 α≥1
Minimal Non-minimal
Conventional Non-redundant GSD
[0, … 9] signed-digit GSD
α=β α=β α≠β
α≠β
(even r)
Asymmetric Symmetric Asymmetric
Symmetric minimal GSD non-minimal non-minimal
minimal GSD GSD GSD
α=0 α=1(r≠2) α=0 α=1, β=r
r=2 α<r
Saved-carry Non-binary Ordinary
Binary Unsigned-digit Stored-carry-or
(SC) SB signed-digit redundant (UDR) -borrow (SCB)
signed-digit (OSD)
(BSD) r=2
α=r/2 +1 α=r-1 r=2
[-1, 0, 1]
Binary saved-carry
(BSC) [0, 1, 2] Minimally Maximally BSCB
redundant redundant
OSD OSD
Capacity
Computer Architecture, IFE Computer Science, 4sem
E 2 E 10
=1.056 , =1.5
E 3 E 2
Non-Positional Numerical Codes
Computer Architecture, IFE Computer Science, 4sem
value Gray
0 000
1 001
2 011
3 010
4 110
5 111
6 101
7 100
Non-Positional Numerical Codes
Computer Architecture, IFE Computer Science, 4sem
digit BCD
0 0000
1 0001
2 0010
3 0011
4 0100 5127DEC = 0101000100100111 BCD
5 0101
6 0110
7 0111
8 1000
9 1001
Natural Binary Code (NBC)
Computer Architecture, IFE Computer Science, 4sem
NBC features:
fixed radix-2 with two digits 0 and 1 →[0, 1] digit set
n-bit representation of non-negative values [0 ... 2n-1]
n−1
a n−1 a n ... a 1 a 0=∑i=0 2 a i
i
Unsigned Integers:
4-bits: range 0 ... 24-1 → 0 ... 15
8-bits: range 0 ... 28-1 → 0 ... 255
16-bits: range 0 ... 216-1 → 0 ... 65 535
32-bits: range 0 ... 232-1 → 0 ... 4 294 967 295
64-bits: range 0 ... 264-1 → 0 ... 18 446 744 073 709 551 615
represented values
−N −1 0 +P
0 +P −0 −1 −N
mapping onto NBC
0000
1111 0001
+0
-7 +1
1110 0010
-6 +2
1101 0011
-5 +3
+
Increment
Increment
1100 0100
-4 +4
1011
− 0101
-3 +5
1010 0110
-2 +6
1001 0111
1000 +7
-1
-0
Biased Coding (Excess-N)
Computer Architecture, IFE Computer Science, 4sem
e.g. −1 → +3
Advantages:
● linear mapping – comparison of two numbers is easy
Disadvantages:
● addition/subtraction requires correction
● multiplication/division is difficult
Biased Coding
Computer Architecture, IFE Computer Science, 4sem
represented values
−N −1 0 +P
−N −1 0 +P
mapping onto NBC
0000
1111 -8 0001
+7 -7
1110 0010
+6 -6
1101 0011
+5 -5
Increment
1100 0100
Increment
+4 -4
+ 0101
1011
+3 -3
1010 0110
+2 -2
1001 0111
+1 1000 -1
0
Complement Coding
Computer Architecture, IFE Computer Science, 4sem
−1 → 15
Advantages:
● simple arithmetic operations – identical as in NBC !!!
Disadvantages:
● less-intuitive representation
Binary 2's Complement Coding (2C)
Computer Architecture, IFE Computer Science, 4sem
Negation of x:
a) simple rule (at binary level): bit_negation(x) + 1
b) from complementation definition: −x → M−x
c) from mixed-radix definition (at binary level):
r = [-2n-1, 2n-2, … , 21, 20]
n−2
a n−1 + ∑i=0 2 a i
n−1 i
A 2C =−2
represented values
−N −1 0 +P
0 +P −N −1
mapping onto NBC
0000
1111 0001
0
-1 1
1110 0010
-2 2
1101 0011
-3 3
+
Increment
Increment
1100 0100
-4 4
− 0101
1011
-5 5
1010 0110
-6 6
1001 0111
1000 7
-7
-8
Binary 1's Complement Coding (1C)
Computer Architecture, IFE Computer Science, 4sem
represented values
−N −1 0 +P
0 +P −N −1 0
mapping onto NBC
0000
1111 0001
0
-0 1
1110 0010
-1 2
1101 0011
-2 3
+
Increment
Increment
1100 0100
-3 4
− 0101
1011
-4 5
1010 0110
-5 6
1001 0111
1000 7
-6
-7