1.8.3 2’s Complement Representation
BIAS EXPONENT
Using the conversion techniques, its 11-bits binary representation is Bias exponent =00100000111
The number is negative, hence the sign bit is 1, and the double precision floating point representation of the given number is :
EXAMPLE 1.37
Find the single precision floating point representation of the decimal number _ i2310.
SOLUTION :
Step-by-Step transformation of _ i2310 into an equivalent floating-
BIAS EXPONENT
In this case bias exponent is obtained by adding 1023 to the actual exponent. The addition of bias allows the use of an exponent in the range from -1023 to +1024, corresponding to a range of 0–2047.
Chapter 1 Number Systems Page 63
point number in single-precision IEEE format is as follows : 1. First find the binary equivalent of given number.
2310
_ i =_10111i2
2. _ i2310 101112 1.0111 24
#
=_ i =
The mantissa is converted to 23-bits significant value by putting zeros to the left side of the number as
Mantissa =0111000 00000000 00000000
3. The bias exponent is the sum of exponent value (4) and bias (127). It is given as
Bias exponent = +4 127=_131i10
Using the conversion techniques, its binary representation is Bias exponent =10000011
4. The number is positive, hence the sign bit is 0, and the single precision floating point representation of the given number is :
2310 01000001 10111000 00000000 00000000
+ =
_ i
EXAMPLE 1.38
Determine the floating-point representation of _-142i10 using IEEE single precision format.
SOLUTION :
1. As a first step, we will determine the binary equivalent of _142i10
. Following the procedure outlined in the earlier part of the chapter, the binary equivalent can be written as _142i10=_10001110i2.
2. _10001110i2 1.000 1110 27
# =
Mantissa =0001110 00000000 00000000. 3. Exponent =00000111.
The bias exponent is the sum of exponent value (7) and bias (127). It is given as
Bias exponent = +7 127=_134i10
Using the conversion techniques, its binary representation is Bias exponent =10000110
4. Sign of mantissa =1
Therefore, _-142i10=11000011 00001110 00000000 00000000
Range of Numbers and Precision
The range of numbers that can be represented in any digital system depends upon the number of bits in the exponent, while the fractional accuracy or precision is defined by the number of bits in the mantissa. The higher the number of bits in the exponent, the larger is the range of numbers that can be represented.
For example, the range of numbers possible in a floating-point binary number format using six bits to represent the magnitude of the
Chapter 1 Number Systems Page 65
EXAMPLE 1.40
Subtract _ i17 8 from _ i218 using floating point numbers and verify the answer. SOLUTION : 218 _ i =_010001i2=0 010001 2. # 6 17 8 _ i =_001111i2=0 001111 2. # 6 Therefore, 218- 178 _ i _ i 0 010001. 0 001111. 26 # =_ - i . 0 000010 26 000010 02 8 # = = =_ i
Also, _21i8-_17i8 =_ i028 and hence is verified.
Page 66 Number Systems Chapter 1
Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in
EXAMPLES
EXAMPLE 1.41
Find the sign-magnitude representation of numbers using 8 bits:
(a) +27 (b) -27 (c) +101 (d) -106 SOLUTION : (a) _ i2710 2710 _ i =_11011i2 00110112
=_ i (Magnitude is represented by 7bits) The number is positive and the most significant bit is 0.
Hence, the sign-magnitude representation of _ i2710=00011011. (b) The binary equivalent of _27i10=_0011011i2
The number is negative and the most significant bit is 1. Hence, sign-magnitude representation of _-27i10=10011011
(c) _101i10
Hence, _101i10 =_1100101i2
The number is positive and the most significant bit is 0.
Chapter 1 Number Systems Page 69
Hence, _ i8810 =_1011000i2
Step 2 : Write the positive number using 8-bits.
8810 +
_ i =_01011000i2
Step 3 : Find the 1’s complement by replacing 0 by 1 and 1 by 0 1’s complement of _+88i10 = -_ 88i10=_10100111i2
EXAMPLE 1.44
Find decimal equivalent of the following binary numbers. (a) _10100111i2 (b) _01010011i2
(c) _10111011i2
Assume the given numbers in 1’s complement representation.
SOLUTION :
(a) Step 1 : Check the sign of the given number.
The most significant bit of the given number is 1; the sign of the number is negative.
Step 2 : Find the 1’s complement of the number. 1’s complement of _10100111i2=01011000
Step 3 : Find the decimal equivalent.
1011000 =1 2# 6+0 2# 5+1 2# 4+1 2# 3+0 2# 2 0 21 0 20 # # + + 64 16 8 = + + =88
Hence, the decimal equivalent of _10100111i2= -_ 88i10
(b) Step 1 : Check the sign of the given number.
The most significant bit of the given number is 0; the sign of the number is positive.
Step 3 : Since the number is positive so 1’s complement representation is same as its binary equivalent. Therefore, the decimal equivalent is
1010011 1 26 0 25 1 24 0 23 0 22 # # # # # = + + + + +1 2# 1+1 2# 0 64 16 2 1 = + + + =83
Chapter 1 Number Systems Page 71
Hence, _ i6410 =_1000000i2
Step 2 : Write the positive number using 8-bits.
6410 +
_ i =_01000000i2
The 2’s complement representation of a positive number is same as the sign magnitude representation of a positive number.
(c) Step 1 : Find the binary equivalent of the number.
Hence, _ i8910 =_1011001i2 010110012
=_ i (adding 0 to the left) Step 2 : Write the positive number using 8-bits.
8910 +
_ i =_01011001i2
Step 3 : Find the 1’s complement by replacing 0 by 1 and 1 by 0. 1’s complement of _+89i10= -_ 89i10=_10100110i2
Step 4 : Find the 2’s complement by adding 1 to 1’s complement.
Hence, the 2’s complement representation of _-89i10=10100111
EXAMPLE 1.46
Find decimal equivalent of the following binary numbers. (a) _10011001i2 (b) _01100111i2
(c) _10101011i2
Assume the given number in 2’s complement representation.
Page 72 Number Systems Chapter 1
Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in (a) Step 1 : Check the sign of the given number.
The most significant bit of the given number is 1; the sign of the number is negative.
Step 2 : Find the 1’s complement of the number. 1’s complement of _10011001i2 =01100110
Step 3 : Find the 2’s complement of the number.
Step 4: Find the decimal equivalent.
110 0111 =1 2# 6+1 2# 5+0 2# 4+0 2# 3+1 2# 2 +1 2# 1+1 2# 0 64 32 4 2 1 = + + + + 103 =
Hence, the decimal equivalent of _10011001i2= -_ 103i10
(b) Given number is _01100111i2
Step 1 : Check the sign of the given number.
The most significant bit of the given number is 0, the sign of the number is positive.
Step 2 :Since the number is positive so 2’s complement representation is same as its binary equivalent. Therefore, the decimal equivalent is
110 0111 1 26 1 25 0 24 0 23 1 22 # # # # # = + + + + +1 2# 1+1 2# 0 64 32 4 2 1 = + + + + 103 =
Hence, the decimal equivalent of _01100111i2= +_ 103i10
(c) Step 1: Check the sign of the given number.
The most significant bit of the given number is 1; the sign of the number is negative.
Step 2: Find the 1’s complement of the number. 1’s complement of _10101011i2 =01010100
Step 3: Find the 2’s complement of the number.
Step 4: Find the decimal equivalent.
1010101 =1 2# 6+0 2# 5+1 2# 4+0 2# 3+1 2# 2 0 21 1 20 # # + + 64 16 4 1 = + + + 85 =
Hence, the decimal equivalent of 10101011 85
2= - 10
Page 74 Number Systems Chapter 1
Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in
A =1101101
B =0110110
Step 2 : 1’s complement of 0110110=1001001
Step 3 : Binary addition
The MSB is 0. So, the result is positive and is in its true form. Result =+_0110111i
(b) 10100-110000
Step 1 : In the complement representation the two operands must have same number of bits.
A =010100
B =110000
Step 2 : 1’s complement of 110000=001111
There is no carry. The MSB is a 1. So, the result is negative and is its 1’s complement form.
Result =-[1’s complement of 100011]
011100
=-_ i
(c) 1101 1011. -10110 11.
Step 1 : In the complement representation the two operands must have same number of bits.
A =01101 1011.
B =10110 1100.
Step 2 : 1’s complement of 10110 1100. =01001 0011.
Step 3 : Binary Addition
There is no carry MSB is 1 so the result is negative and is in its 1’s complement form. Result =-[1’s complement of 10110 1110. ] . 01001 0001 =-_ i (d) 10110 01. -1011 1101.
Page 76 Number Systems Chapter 1
Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in Step 2 : 1’s complement representation of _-27 50. i=11100100 0111.
Step 3 : Binary Addition
The MSB is 0. So, the result is positive and in its true binary form. Result =_00101001 0100. i
. 41 2510
=_ i
EXAMPLE 1.50
Perform the following binary subtraction using 2’s complement method. (a) 1001-101000 (b) 10100-110000 (c) 1101 1011. -10110 11. SOLUTION : (a) 1001-101000
Step 1 : In the complement representation the two operands must have same number of bits.
A =001001=_ i910
B =101000=_ i4010
Step 2 : Find 2’s complement of B
Step 3 : Binary Addition
There is no carry, the MSB is 1. So, the result is negative and is in 2’s complement form.
Result =2’s complement of 10001
011111 3110
= = -_ i
(b) 00110011-00010000
Step 1 : Both the operands are in 8-bits.
A =_00110011i2=_51i10
Page 78 Number Systems Chapter 1
Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in