0
Fixed Point Format and Floating Point Format Examples
• It is found that in the floatingpoint representation we can cover a much larger range of numbers than that is possible in the fixedpoint representation.
• In the floatingpoint representation the resolution decreases with an increase in the size of the range; this means that the distance between two successive floatingpoint numbers increases.
• In the floatingpoint scheme, resolution is variable within the range. However, for the fixedpoint format, resolution is fixed and uniform.
• This variability in resolution provides a large dynamic range of the numbers.
We have, for the smallest possible number in this scheme, mantissa = 0.5, which is the minimum possible value of mantissas in the floatingpoint scheme, as stated earlier. This is then represented under the column M as .1 followed by eight 0s (i.e., .100000000). The sign of the mantissa is taken as positive and is represented by a 0 under the column S_{M}. Since the exponent has 5 bits to represent it, the highest possible number in this case will be 2^{5} = 32. Using this as the exponent, we get the smallest number in our present case as
We find that this is achieved by sacrificing uniformity in resolution. Notice that in the floatingpoint format, compared to larger numbers, whose resolution is coarse, small numbers have finer resolution.
The IEEE 754 Standard (Floatingpoint format) for 32bit Machines
IEEE 754 standard for floatingpoint arithmetic in 32bit computers is shown in Table 1.39.
• In the floatingpoint representation the resolution decreases with an increase in the size of the range; this means that the distance between two successive floatingpoint numbers increases.
• In the floatingpoint scheme, resolution is variable within the range. However, for the fixedpoint format, resolution is fixed and uniform.
• This variability in resolution provides a large dynamic range of the numbers.
To the ideas given above can be illustrated, by considering case of a 16bit computer.
Example 35: Consider a 16bit computer. Obtain the dynamic range and resolution when the computer is operated (a) fixedpoint format and (b) in the floatingpoint format.
Solution:
(a) For the 16bit computer, with one bit reserved for representing the sign, the highest positive and negative numbers that can be represented in the fixedpoint format are (2^{m}^{}^{1}  1) and (2^{m}^{}^{1 } 1), respectively, where m = 16. Substituting for m = 16 yields:
The highest positive number = 2^{16}^{}^{1 } 1 = 2^{15}1 = 32767
The highest negative number = (2^{16}^{}^{1 } 1) = (2^{15}1) = 32767
This means that we can represent all the whole numbers from 32,767 to + 32,767. Since the numbers represented are of the form 32,767, 32,766, 32,765, …, 32,766, and 32,767 (i.e., successive numbers differing by one digit), we find that in this scheme:
Resolution = 1
In this scheme, we also find that we can represent only whole numbers; we can not represent fractions.
Now, suppose we want to express fractions also through this scheme. For this, let us reserve 5 bits to represent the fractional part, 10 bits to represent the integer part, and 1 bit to represent the sign of the mantissa. In the fixedpoint representation, the given number can now be written as
X = ± (2^{10}  1) ´ 2^{}^{5}^{ }= ± 31.96875
Thus the range in this case will be between 31.96875 and +31.96875. We have:
Resolution = 2^{}^{5}^{ }= 0.00001
We find that in this case, the range (sometimes called the dynamic range) has been considerably decreased, but resolution has been greatly increased.
(b) FloatingPoint Format
In the floatingpoint format, we reserve 5 bits to represent the exponent, 1 bit to represent its sign, 9 bits to represent the mantissa part, and 1 bit to represent its sign. Table 1.38 shows the floatingpoint representation of the given number.
Table 1.38 Floatingpoint representation in a 16bit computer
S_{M}

M (9 bits)

S_{E}

E (5 bits)

0

0.1 0 0 0 0 0 0 0 0

1

1 1 1 1 1

0

0.1 0 0 0 0 0 0 0 0

0

1 1 1 1 1

In Table 1.38, S_{M }_{ }represents the sign bit of mantissa, M represents the mantissa, S_{E} represents the sign bit of exponent, and E represents the exponent. We find that row 2 shows the smallest bit that can be represented in this format. This is obtained as follows:
We have, for the smallest possible number in this scheme, mantissa = 0.5, which is the minimum possible value of mantissas in the floatingpoint scheme, as stated earlier. This is then represented under the column M as .1 followed by eight 0s (i.e., .100000000). The sign of the mantissa is taken as positive and is represented by a 0 under the column S_{M}. Since the exponent has 5 bits to represent it, the highest possible number in this case will be 2^{5} = 32. Using this as the exponent, we get the smallest number in our present case as
We find that this is achieved by sacrificing uniformity in resolution. Notice that in the floatingpoint format, compared to larger numbers, whose resolution is coarse, small numbers have finer resolution.
The IEEE 754 Standard (Floatingpoint format) for 32bit Machines
IEEE 754 standard for floatingpoint arithmetic in 32bit computers is shown in Table 1.39.
Table 1.39 IEEE 754 standard for 32bit machines
Sign (S)

Exponent (E)

Mantissa (M)

0

1 8

9 31

In this scheme, we have 23 bits reserved for representing the mantissa, one bit for the sign of the mantissa (S), 7 bits for the exponent, and one bit for the sign of the exponent. The maximum number in this scheme is
0
Binary Fractions and Floating Point
Expressing binary fractions in the floatingpoint format may also be done using the same method we have developed above. We shall illustrate the technique by using a numerical example.
1/4 = 0.25 = 0. 010
Now, since the given number is a fraction, we employ the reverse of our previous technique, i.e., first multiply and then divide (instead of first dividing and then multiplying) for its floatingpoint representation. Also, since there are only two bits in the given fraction 0.01 (the 0 after the 1 is not counted), it seems quite natural that we use 2^{2} for multiplying and dividing it. However, we have imposed a restriction on the mantissa M that for binary floatingpoint format it should lie in between ½ and 1. Imposition of this restriction means that we have to express the mantissa as 0.1, and not as 0.01. This further means that we have to multiply and divide the number by 2^{1}, and not by 2^{2}. Performing this operation yields
Example 34: Express decimal fraction ¼ in the binary floatingpoint format.
Solution: As the first step, we convert the given decimal fraction into regular binary fraction. The conversion yields
1/4 = 0.25 = 0. 010
Now, since the given number is a fraction, we employ the reverse of our previous technique, i.e., first multiply and then divide (instead of first dividing and then multiplying) for its floatingpoint representation. Also, since there are only two bits in the given fraction 0.01 (the 0 after the 1 is not counted), it seems quite natural that we use 2^{2} for multiplying and dividing it. However, we have imposed a restriction on the mantissa M that for binary floatingpoint format it should lie in between ½ and 1. Imposition of this restriction means that we have to express the mantissa as 0.1, and not as 0.01. This further means that we have to multiply and divide the number by 2^{1}, and not by 2^{2}. Performing this operation yields
X = (0.01 x 2^{1})(1/2^{1}) = 0.1 x 2^{1}
Now, the exponent of X, which is a negative integer, must also be expressed in binary,as stated above. Carrying out this exercise, our floatingpoint representation of decimal fraction ¼ becomes
X = (0.01 x 2^{1})(1/2^{1}) = 0.1 x 2^{1001}
where the first 1 in the exponent represents the negative sign, and the next three bits, viz. 001, represent decimal 1.
0
Floating Point Representation Examples
Consider the decimal number 468. We can express this in the form
Here, we first divided and then multiplied 468 by 1000 so that its value does not change. In this process, the division by 1000 had converted 468 into a fraction, and the multiplication by 1000 ensured that its value remained unchanged at 468 itself. Thus, in our example, we expressed 468 as the product of a fractional part (0.468) and an exponent part (10^{3}). This type representation of numbers is called the floatingpoint representation. The fractional (decimal part) is called as mantissa, and the exponential part is called as exponent. Thus to express a given decimal number in the floatingpoint format, the steps to be followed are:
468 = 468/1000 = 0.468 ´ 10^{3}
Here, we first divided and then multiplied 468 by 1000 so that its value does not change. In this process, the division by 1000 had converted 468 into a fraction, and the multiplication by 1000 ensured that its value remained unchanged at 468 itself. Thus, in our example, we expressed 468 as the product of a fractional part (0.468) and an exponent part (10^{3}). This type representation of numbers is called the floatingpoint representation. The fractional (decimal part) is called as mantissa, and the exponential part is called as exponent. Thus to express a given decimal number in the floatingpoint format, the steps to be followed are:
1. First, divide the given number by an appropriate power of 10 (radix of the decimalnumber system) so that it is converted into a fraction.
2. Multiply the resulting fraction with the same power of 10 (10^{3}, here) so that division is cancelled by multiplication; this brings the number back to its original value (468, here).
The steps given above may be extended to the binarynumber system also to represent a given number in the floatingpoint format.
Example 33: Express decimal number 7 in the binary floatingpoint format.
Solution: Consider decimal number 7. The binary equivalent of 7 is 111. To express this in the floatingpoint format, we divide 111 with an appropriate power of 2. Since there are three bits in the given number, extending our theory from the decimal system given above, we have to divide and multiply 111 by 2^{3}. Then X can be written in the form
X = (111/2^{3}) × 2^{3 }= 0.111× 2^{3}
In the binary floatingpoint format, we must express the exponent also in binary. The binary equivalent of decimal 3 is 011. As this is a positive exponent, we use sign bit 0 in the first bit position of the exponent Thus the complete floatingpoint representation of decimal number 7 is:
X = 0.111× 2^{0011}
To check whether our operation has yielded the correct answer, we expand the above relation
X = 0.111 x 2^{3 }= (1 x 2^{1}+1 x 2^{2} + 1 x 2^{3}) x 2^{3} = 7
The result of this checking operation shows the correctness of our method. Now, we generalize the floatingpoint method with the expression
X = M ´ R^{E} (1.19)
where M = mantissa, R = radix of the number system used, and E = exponent. Now, to express X in the floatingpoint scheme (when it is a whole number), we multiply and divide X by R^{E}> Thus
X = (X/ R^{E}) x R^{E}
^{ }
^{ }
where E is dependent on the number of bits in X. From the above, we find
M = X/ R^{E} (1.20)
In the example using decimal number 468, we had X = 468, R = 10, E = 3, and therefore M = 0.468.
Let us now consider the binary floatingpoint scheme again. Even though, we can use any number as the mantissa, in the binary floatingpoint format, a restriction has been imposed on it: it should lie between ½ and 1. That is
0.5 ≤ M ≤ 1 (1.21)
This restriction imposes the condition that the first bit after the binary point must be a 1.
0
Fixed Point Representation in Digital Electronics
Representation of Binary Numbers
We can represent binary numbers also in fixedpoint representation using a similar format. For example, the binary number
Range of Numbers in the FixedPoint Arithmetic
In the fixedpoint arithmetic, to restrict the maximum and minimum numbers so that they can be stored and processed in registers of finite lengths, we require two operations known as truncation and round off. Truncation is the operation of abruptly terminating a given number at some desired significantbit (or digit) position. Round off (or simply, rounding) is the operation of approximating the truncated number at the same or next higher value. These are the same terms that we have been using in our daytoday arithmetic. For example, consider the product
Binary numbers are represented in digital systems in one of the following two formats:
· Fixedpoint representation
· Floatingpoint representation
The FixedPoint Representation
Consider the decimal number
X = 10587.349
This type of representation of a number as a string of digits with the decimal point in between two smaller strings (or groups) of digits is called as fixedpoint representation. The group of digits to the left of decimal point is called as integer part, and those to the right of the decimal point is called as fractional (decimal) part.
We can represent binary numbers also in fixedpoint representation using a similar format. For example, the binary number
Y = 101001.01011
is written in the fixedpoint format. Here, the point symbol is called as binary point (similar to decimal point). As in the case of the decimalnumber representation, to the left of the binary point, we have the integer part, and to its right, the fractional part.
The idea of using binary points to represent fractional parts exists only in theory; in practical systems, however, they are not represented in this format. Instead, we designate some locations in the memory of the computer to represent the integer part, and some other locations to represent the fractional part.
We may generalize the representation of numbers in the fixedpoint arithmetic by expressing the number X in the format.
The most significant bit 0 indicates that the number represented in Eq. (1.13) is a positive number. Similarly, the general expression for representing negative numbers in the fixedpoint arithmetic is:
The general expression given in Eq. (1.14) may be modified in one of the three formats given below to represent negative numbers in the fixedpoint arithmetic.
Representation of Negative Numbers and Fractions
Negative numbers or fractions are represented in binary systems in the following formats:
· Signmagnitude format
· One’scomplement format
· Two’scomplement format
The SignMagnitude Format
In digital computers, we have to represent both positive and negative numbers. For this, we use an additional bit, called the sign bit, in the most significant bit (MSB) position. We use 0 to represent positive and 1 to represent negative numbers in the MSB position. This scheme of representing numbers is known as the signmagnitude format. For example, consider the decimal number 4. Its binary equivalent is 0100. In the signmagnitude format, we can express this number in the form
+4 = 00100
4 = 10100
In the above example, we have represented whole number in the signmagnitude format. We may also require signmagnitude representation of fractions. Consider the binary fraction
X = 0.11010001
This can be represented in the signmagnitude format as
X = 1.11010001
where the 1 to the left of the binary point (i.e., the MSB) indicates that the binary fraction following this bit is negative. The general expression with which negative numbers are represented in the signmagnitude format can now be written as
In the signmagnitude scheme, multiplication of two numbers is a relatively straightforward process and does not involve the usage of any special algorithm. This is the advantage of this scheme. But as far as addition is concerned, this scheme requires a more complex procedure to be followed in which operations such as sign checks, complementing, and carrygeneration are involved.
The One’sComplement Format
In the 1’scomplement format, negative numbers are represented as 1’scomplement of the given number. For example, consider the binary number
X = 0.11010001
By changing 1s to 0s and 0s to 1s, we get its 1’scomplement as
Y = 1.00111110
The general expression with which negative numbers are represented in the one’scomplement format can now be written as
where `b_{m} is the 1’s complement of the number b_{m}.
It is easy to multiply two 1’scomplement numbers, as this is a straightforward procedure. But addition requires special algorithms. Even though 1’scomplement scheme can be used for mathematical processing in digital systems, because of its obvious advantages in carrygeneration, 2’scomplement scheme is used in majority of signalprocessing computers that employ fixedpoint arithmetic.
It is easy to multiply two 1’scomplement numbers, as this is a straightforward procedure. But addition requires special algorithms. Even though 1’scomplement scheme can be used for mathematical processing in digital systems, because of its obvious advantages in carrygeneration, 2’scomplement scheme is used in majority of signalprocessing computers that employ fixedpoint arithmetic.
The Two’sComplement Format
We have seen that 2’scomplement of a given number is obtained by adding a 1 to the LSB (leastsignificant bit) of 1’s complement of that number. For example, consider the binary number
X = 0.1101 0001
1’scomplement of 0.1101 0001
X′ = 1.0010 1110
Now adding a 1 to X′ yields its 2’s complement:
Z = 1.00101111
The general expression with which negative numbers are represented in the 2’scomplement format can now be written as
where b_{m} is the 1’s complement of the given number b_{m}. The symbol Å represents modulo2 addition of 1 with the 1’s complement of the given number. Modulo2 addition is used, so that the carry generated in the sign bit can be ignored. It can be seen from practical examples that the carry generated in the sign bit has to be ignored; then only the mathematical operations employing 2’scomplement will produce correct results.
Consider the 4bit representation of binary numbers in the fixedpoint arithmetic. We find that in this scheme since one bit has to be reserved for the sign bit, we can represent a maximum of 2^{3} (= 8) positive numbers. The eight positive numbers are 0.000 to 0.111. Similarly, we may represent a maximum of 2^{3} (= 8) negative numbers in this scheme. The negative numbers are 1.001 to 1.111. Thus the total number of positive and negative numbers in this case is sixteen.
We may now obtain a general expression for the range of numbers in the fixedpoint format. Let the number of bits that the given computer can accommodate be m. Of these m bits, we have to keep one bit ready for the representing the sign. The remaining (m − 1) bits can be used to represent the numbers. This means that we can represent a total of 2^{m}^{‒1} positive numbers, and 2^{m}^{‒1} negative numbers. Thus in this scheme, the range of the numbers
R = (2^{m}^{‒1}1) to (2^{m}^{‒1}1) (1.18)
For example, consider the case of a 64bit computer. With fixedpoint format, the numbers that can be represented by it lie between
(2^{63} 1) and (2^{63} 1)
Even though this appears to be a large range of numbers, in reality, it is not so. It can be seen that the floatingpoint scheme can accommodate much larger numbers than the fixedpoint scheme.
In the fixedpoint arithmetic, to restrict the maximum and minimum numbers so that they can be stored and processed in registers of finite lengths, we require two operations known as truncation and round off. Truncation is the operation of abruptly terminating a given number at some desired significantbit (or digit) position. Round off (or simply, rounding) is the operation of approximating the truncated number at the same or next higher value. These are the same terms that we have been using in our daytoday arithmetic. For example, consider the product
3.256789 ´ 7 = 22.797523
Now, let us truncate this number to three significant digits after the decimal point. This means that we have to terminate the number abruptly at the third digit from the decimal point. In truncation operation, we stop at the desired digit, and do not look for the digit that comes after the truncated one. Using this theory, we find that the truncated number in our example is 22.797.
However, we know that abrupt truncation is not a desired operation. In practice, for a better approximation of the given number, we always look for next digit after the truncated digit. If this digit is greater than or equal to 5, we add a 1 to the truncated digit; if it is less than 5, we discard it. This operation is called rounding off. In our example, we had truncated the given number at the third digit after the decimal point (i.e., at 22.797). We now look for the fourth digit in the number, and find that it is a 5. Therefore, as per our roundoff theory, we have to add a 1 to the truncated digit, and this operation makes the given number equal to 22.798 in the combined operations of truncation and roundedoff.
The principle of truncation and round off can be extended to binary number system also. We find that in binary system, for rounding off, we add a 1 to the truncated bit if the next bit after the truncated bit is a 1; if it is a 0, we leave the truncated bit as such without any modification. Consider, for example, the binary number 11101101001. We want this to be truncated at the third bit after the binary point. Performing this operation, we get the truncated number as 1110.110.
To round off the number at this point, we find that the next bit (i.e., the fourth bit after the binary point) is a 1. So, we add this to the third bit and the truncated and roundedoff number will be 1110.111. However, if the fourth bit were a 0, then the third bit will be left as such. This means that the truncated number 1110.110 itself will be the roundedoff number.
2
Subtraction using 1's Complement & 2's Complement
Subtraction Using 1’s Complement (Indirect Subtraction)
We can perform subtraction by adding minuend to the complement of subtrahend and doing some further manipulations in the sum so obtained. The steps involved in this procedure are:
1. Find the 1’s complement of subtrahend. For this, in the decimal system, subtract the subtrahend from 9 if it is a singledigit number, 99 if it is a doubledigit number, and so on. In binary system, complementary number can be obtained by changing 0s to 1s and 1s to 0s.
2. Next, add minuend and complement of subtrahend. This is called as 9’s complement addition in decimal system and 1’s complement in binary system.
3. Finally, add the most significant digit (or, bit) in the sum to the least significant digit (or, bit) in the remaining portion of the number from which the MSD is removed to obtain the resulting subtracted number.
Example 30: Subtract decimal number 4 from decimal number 7.
Solution: Following step 1, we find the 9’s complement of 4, which is 9 ‒ 4 = 5. Next, add 7 and 5 to yield 12. Finally, add MSD 1 to LSD 2 to get 3. We find that this is the desired result.
Example 31: Subtract binary number 100 from binary number 111.
Solution: To solve this problem, we use the steps given in Section 1.17.2.
1. 1’s complement of 100 = 011
2. 111 + 011 = 1010
3. Removing MSB 1 and adding it to the remaining portion of 010 in 1010, we get
Desired sum = 010 + 1= 011
We find that 011 is the desired result.
Subtraction using 2’s Complement
Step 3 of Section (Subtraction using 1's Complement) requires that for binary subtraction using 1’s complement, shifting and addition of MSB with LSB has to be performed. Binary subtraction can also be performed using 2’s complement.
2’s complement of a given number is obtained by adding binary 1 to its 1’s complement. For example, we know that 1’s complement of 101 is 010. Adding 1 to 010 yields the 2’s complement of 101 as 010 + 1= 011. The steps involved in binary subtraction using 2’s complement are:
1. Find the 1’s complement of subtrahend.
2. Add 1 to the 1’s complement to get the 2’s complement of subtrahend.
3. Add minuend and 2’s complement of subtrahend.
4. Discard the MSB to get the desired difference.
Example 32: Subtract (100)_{2} from (111)_{2} using 2’s complement.
Solution: To solve this problem, we use the steps given in Section 'Subtraction using 2's Complement'.
1. 1’s complement of 100 = 011.
2. 1 + 011 = 100.
3. 111 + 100 = 1011
4. Discard the MSD 1 from 1011. We the get
Difference = 011
This is the desired result.
We can perform subtraction by adding minuend to the complement of subtrahend and doing some further manipulations in the sum so obtained. The steps involved in this procedure are:
1. Find the 1’s complement of subtrahend. For this, in the decimal system, subtract the subtrahend from 9 if it is a singledigit number, 99 if it is a doubledigit number, and so on. In binary system, complementary number can be obtained by changing 0s to 1s and 1s to 0s.
2. Next, add minuend and complement of subtrahend. This is called as 9’s complement addition in decimal system and 1’s complement in binary system.
3. Finally, add the most significant digit (or, bit) in the sum to the least significant digit (or, bit) in the remaining portion of the number from which the MSD is removed to obtain the resulting subtracted number.
Example 30: Subtract decimal number 4 from decimal number 7.
Solution: Following step 1, we find the 9’s complement of 4, which is 9 ‒ 4 = 5. Next, add 7 and 5 to yield 12. Finally, add MSD 1 to LSD 2 to get 3. We find that this is the desired result.
Example 31: Subtract binary number 100 from binary number 111.
Solution: To solve this problem, we use the steps given in Section 1.17.2.
1. 1’s complement of 100 = 011
2. 111 + 011 = 1010
3. Removing MSB 1 and adding it to the remaining portion of 010 in 1010, we get
Desired sum = 010 + 1= 011
We find that 011 is the desired result.
Subtraction using 2’s Complement
Step 3 of Section (Subtraction using 1's Complement) requires that for binary subtraction using 1’s complement, shifting and addition of MSB with LSB has to be performed. Binary subtraction can also be performed using 2’s complement.
2’s complement of a given number is obtained by adding binary 1 to its 1’s complement. For example, we know that 1’s complement of 101 is 010. Adding 1 to 010 yields the 2’s complement of 101 as 010 + 1= 011. The steps involved in binary subtraction using 2’s complement are:
1. Find the 1’s complement of subtrahend.
2. Add 1 to the 1’s complement to get the 2’s complement of subtrahend.
3. Add minuend and 2’s complement of subtrahend.
4. Discard the MSB to get the desired difference.
Example 32: Subtract (100)_{2} from (111)_{2} using 2’s complement.
Solution: To solve this problem, we use the steps given in Section 'Subtraction using 2's Complement'.
1. 1’s complement of 100 = 011.
2. 1 + 011 = 100.
3. 111 + 100 = 1011
4. Discard the MSD 1 from 1011. We the get
Difference = 011
This is the desired result.
0
Binary Subtraction with Examples
Binary Subtraction with Examples:
Binary subtraction is performed in the same way we perform decimal subtraction. There are two methods for decimal and binary subtraction. In the first method, we use direct subtraction. In the second method, we use an indirect subtraction method called complement’s method. We first discuss the direct subtraction.
Direct Subtraction
In this scheme, we subtract a smaller number from a larger number. This is illustrated using an example of decimal subtraction.
Example 28: Subtract decimal number 657 from decimal number 725.
Solution: To subtract, we write the numbers one below the other as shown in Table 1.33. Then we first subtract the leastsignificant digit (LSD) 7 from LSD 5. This subtraction is not possible. Therefore, we borrow a 1 from digit 3 in the second bit position and transfer it to LSD position. When this reaches LSD, it gains a weight of 10 and we add this to LSD 5 to make it 10+5 = 15. We can now subtract 7 from 15 to yield the difference 8 in the LSD position.
We then move to the second digit position of 3. Since a 1 was borrowed from this place to LSD, we have only a 2 remaining in this position. We now try to subtract 5 from 2 and this is not possible. Therefore, as in the previous case, we borrow a 1 from the most significant digit (MSD) position and add the new weight of 10 to 2 to make it 12. We can subtract 5 from 12 to yield the difference of 7 in the second digit position, as shown in Table 1.34.
Finally, we notice that when a 1 is borrowed from the MSD, the digit remaining there would be 6 and 6 ‒ 6 = 0 as the difference in MSD.
Binary subtraction is performed in the same way we perform decimal subtraction. There are two methods for decimal and binary subtraction. In the first method, we use direct subtraction. In the second method, we use an indirect subtraction method called complement’s method. We first discuss the direct subtraction.
Direct Subtraction
In this scheme, we subtract a smaller number from a larger number. This is illustrated using an example of decimal subtraction.
Example 28: Subtract decimal number 657 from decimal number 725.
Solution: To subtract, we write the numbers one below the other as shown in Table 1.33. Then we first subtract the leastsignificant digit (LSD) 7 from LSD 5. This subtraction is not possible. Therefore, we borrow a 1 from digit 3 in the second bit position and transfer it to LSD position. When this reaches LSD, it gains a weight of 10 and we add this to LSD 5 to make it 10+5 = 15. We can now subtract 7 from 15 to yield the difference 8 in the LSD position.
We then move to the second digit position of 3. Since a 1 was borrowed from this place to LSD, we have only a 2 remaining in this position. We now try to subtract 5 from 2 and this is not possible. Therefore, as in the previous case, we borrow a 1 from the most significant digit (MSD) position and add the new weight of 10 to 2 to make it 12. We can subtract 5 from 12 to yield the difference of 7 in the second digit position, as shown in Table 1.34.
Finally, we notice that when a 1 is borrowed from the MSD, the digit remaining there would be 6 and 6 ‒ 6 = 0 as the difference in MSD.
The steps described above can be used for direct subtraction of smaller numbers from larger numbers. Hence, we will adopt the same procedure to perform binary subtraction. As in the case of binary addition, for subtraction also we prepare subtraction tables. Table 1.35 shows the 2bit subtraction, and Table 1.36 shows the 3bit subtraction.
Example 29: Subtract binary number 110 from binary number 1110.
Solution: To subtract, we write the numbers one below the other as shown in Table 1.37.
Subscribe to:
Posts (Atom)