Number System
Number System
Number Systems
LEARNING OBJECTIVES
1 1 \ (347)10= (533)8
Ans: (533.7341)8
= (1110100000)2
Chapter 1 • Number Systems | 1.5
Hexa Decimal Binary
Example 21: (18.675)10
A 10 1010
(18)10
F 15 1111
16 18 B 11 1011
1 2 C 12 1100
Decimal Hexa B 11 1011
1 – 1 E 14 1110
2 – 2 (18)10= (12)16 D 13 1101
(0.675)10 = (1010111110111100.101111101101)2
1.6 | Unit 1 • Digital Logic
Binary to hexadecimal number system Example 32: 10’s complement of (2657)10 is (10)4 – 2657
To convert binary number to a hexadecimal number, start- 10000
ing from the binary point, make groups of 4-bits each on 2657
either side of the binary point and replace each 4-bit group 7343
by the equivalent hexadecimal digit. Example 33: 9’s complement of (2657)10 is (104 -1) - 2657
Example 26: (11001001)2 10000
1100 1001 – 1
→ 9999
12 9
2657
→ (C9)16
7342
Example 27: (1011011011.01111)2
•• r’s complement can be obtained by adding 1 to (r – 1)’s
0010 1101 1011 0111 1000 complement.
⋅ = (2 DB.78)16
2 D B 7 8 r m – N = {(r m - 1) – N} + 1
Example 34: 2’s complement of (101101)2 is
Hexadecimal to octal number system = (2)6 – 101101
The simplest way to convert hexadecimal to octal is, first (26)10 = (100000)2
convert the given hexadecimal number to binary and the 2’s complement is 100000
Binary number to Octal. –101101
Example 28: (C3AF)16 010011
→ 001100001110101111 Example 35: 1’s complement of (101101)2 is
→ (141657)8 26 – 1 = 1000000
Example 29: (C6.AE)16 – 1
→ 0011000110.10101110 111111
→ (306.534)8 101101
1’s complement –010010
Octal to hexadecimal number system The one’s complement of a binary number is formed by
The simplest way to convert octal to hexadecimal is first changing 1’s to 0’s and 0’s to 1’s, The 2’s complement can
convert the given octal number to binary and then the binary be formed by leaving all least significant 0’s and the first 1
number to hexadecimal. unchanged, and replacing 1’s with zeros and zeros with 1’s
in all other bits.
Example 30: (775)8
If the number M contains radix point, the point should be
→ (000111111101)2
removed temporarily in order to form r’s/ (r - 1)’s complement.
→ (1FD)16
The radix point is then restored to the complemented
Example 31: (34.7)8 number in the same relative position.
→ (00011100.1110)2
Example 36: What is 1’s complement of (1001.011)2?
→ (1C.E)16
→ Consider without radix point 1001011
Take 1’s complement 0110100
Complements Place radix point again (0110.100)2
Complements are used in digital computers to simplify the Example 37: What is 2’s complement of (1001.011)2?
subtraction operation and for logical manipulation. Consider without radix point 1001011
There are two types of complements for each base - Take 2’s complement 0110101
r-system. Place radix point again (0110.101)2
1. Radix complement (or) r’s complement: the r’s com- Complement of a complement is equal to the original
plement of an m digit number N in base r is r m – N for number r m – (r m – M) = M
N ≠ 0.
For example, N = 0, r’s complement is 0. Subtraction with Complements
2. Diminished radix complement: (or) (r -1)’s comple- Subtraction of two n digit unsigned numbers A - B in base r
ment: Given a number N in base r having m digits, then can be done as follows by r’s complement method.
(r -1)’s complement is (r m - 1) - N. Add A to the r’s complement of B. Mathematically
For example, decimal number system will have 10’s A + (r n - B) = A - B + r n
complement and 9’s complement. If A ≥ B the sum will produce an end carry r n; which can
Similarly, binary number system will have 2’s com- be discarded. (Discarding carry is equivalent to subtracting
plement and 1’s complement. r n from result). What is left is the result A – B?
Chapter 1 • Number Systems | 1.7
Codes
Numeric Alphanumeric
Gray Gray
8421 2421 3321 4221 5221 5311 5421 631-1 7421 74-2-1 84-2-1
Exercises
Practice Problems 1 2. If (84)x (in base x number system) is equal to (64)y (in
base y number system), then possible values of x and y
Directions for questions 1 to 15: Select the correct alterna-
are
tive from the given choices.
(A) 12, 9 (B) 6, 8
1. Assuming all the numbers are in 2’s complement rep- (C) 9, 12 (D) 12, 18
resentation, which of the following is divisible by
11110110? 3. Let A = 1111 1011 and B = 0000 1011 be two 8-bit
(A) 11101010 (B) 11100010 signed 2’s complement numbers. Their product in 2’s
(C) 11111010 (D) 11100111 complement representation is
Chapter 1 • Number Systems | 1.11
(A) 11001001 (B) 10011100 code. For example, the base -6 number 35 will be rep-
(C) 11010101 (D) 10101101 resented by its BCH code 011101.
In this numbering system, the BCH code
4. Let r denotes number system’s radix. The only value(s)
001001101011 corresponds to the following number
of r that satisfy the equation 3 (1331) r = (11) r is/are in base -6 system.
(A) 10 (B) 11 (A) 4651 (B) 4562
(C) 10 and 11 (D) any r > 3 (C) 1153 (D) 1353
5. X is 16-bit signed number. The 2’s complement repre- 11. The signed 2’s complement representation of (-589)10
sentation of X is (F76A)16. The 2’s complement repre- in Hexadecimal number system is
sentation of 8 × X is (A) (F24D)16 (B) (FDB3)16
(A) (1460)16 (B) (D643)16 (C) (F42D)16 (D) (F3BD)16
(C) (4460)16 (D) (BB50)16
12. The base of the number system for which the following
6. The HEX number (CD.EF)16 in octal number system is 66
(A) (315.736)8 (B) (513.637)8 operation is to be correct = 13
5
(C) (135.673)8 (D) (531.367)8 (A) 6 (B) 7
7. 8-bit 2’s complement representation a decimal number (C) 8 (D) 9
is 10000000. The number in decimal is 13. The solution to the quadratic equation x2 - 11x + 13 = 0
(A) +256 (B) 0 (in number system with radix r) are x = 2 and x = 4.
(C) -128 (D) -256 Then base of the number system is (r) =
8. The range of signed decimal numbers that can be rep- (A) 7 (B) 6
resented by 7-bit 1’s complement representation is (C) 5 (D) 4
(A) -64 to + 63 (B) -63 to + 63 14. The 16’s complement of BADA is
(C) -127 to + 128 (D) -128 to +127 (A) 4525 (B) 4526
9. Decimal 54 in hexadecimal and BCD number system is (C) ADAB (D) 2141
respectively 15. (11A1B)8 = (12CD)16, in the above expression A and B
(A) 63, 10000111 (B) 36,01010100 represent positive digits in octal number system and C
(C) 66, 01010100 (D) 36, 00110110 and D have their original meaning in Hexadecimal, the
10. A new binary-coded hextary (BCH) number system values of A and B are?
is proposed in which every digit of a base -6 number (A) 2, 5 (B) 2, 3
system is represented by its corresponding 3-bit binary (C) 3, 2 (D) 3, 5
11. If x is radix of number system, (211)x = (152)8, then x is 17. Match the items correctly
(A) 6 (B) 7 Column 1 Column 2
(C) 9 (D) 5 (P) 8421 (1) Cyclic code
12. The value of r for which ( 224) r = (13) r is valid (Q) 2421 (2) self-complementing
expression, in number system with radix r is? (R) 5212 (3) sequential code
(A) 5 (B) 6 (S) Gray code (4) non-sequential code
(C) 7 (D) 8
(A) P–2, Q–4, R–3, S–1
13. Which of the representation in binary arithmetic has a (B) P–1, Q–4, R–3, S–2
unique zero? (C) P–3, Q–2, R–4, S–1
(A) sign-magnitude (B) 1’s compliment (D) P–2, Q–4, R–1, S–2
(C) 2’s complement (D) All of these
18. Perform the subtraction in XS-3 code 57.6 - 27.8
14. For the binary number 101101111 the equivalent hexa-
(A) 0101 1100.1011 (B) 0010 1001.1100
decimal number is
(C) 00011101.1100 (D) 1010 1110.1011
(A) 14E (B) 9E
(C) B78 (D) 16F 19. The 2’s complement representation of -17 is
15. Subtract 1001 from 1110 (A) 101110 (B) 111110
(A) 0010 (B) 0101 (C) 101111 (D) 110001
(C) 1011 (D) 1010
20. The decimal 398 is represented in 2421 code by
1 6. Which of the following is a positively weighted code? (A) 110000001000 (B) 001110011000
(A) 8421 (B) 84-2-1 (C) 001111111110 (D) 010110110010
(C) EXS-3 (D) 74-2-1
Answer Keys
Exercises
Practice Problems 1
1. B 2. C 3. A 4. D 5. D 6. A 7. C 8. B 9. B 10. C
11. B 12. D 13. C 14. B 15. D
Practice Problems 2
1. C 2. B 3. A 4. D 5. D 6. B 7. A 8. B 9. B 10. B
11. B 12. A 13. C 14. D 15. B 16. A 17. C 18. A 19. C 20. C