






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Binary number system and conversions
Typology: Exercises
1 / 10
This page cannot be seen from the preview
Don't miss anything!







1
1 8
Representation of Negative Numbers
In our traditional arithmetic we use the “+” sign before a number to indicate it as a positive number and a “-” sign to indicate it as a negative number. We usually omit the sign before the number if it is positive. This method of representation of numbers is called “sign-magnitude” representation. But using “+” and “-” signs on a computer is not convenient, and it becomes necessary to have some other convention to represent the signed numbers. We replace “+” sign with “0” and “-” with “1”. These two symbols already exist in the binary system. Consider the following examples:
(+1100101) 2 (01100101) 2 (+101.001) 2 (0101.001) 2 (-10010) 2 (110010) 2 (-110.101) 2 (1110.101) (^2)
In the sign-magnitude representation of binary numbers the first digit is always treated separately. Therefore, in working with the signed binary numbers in sign-magnitude form the leading zeros should not be ignored. However, the leading zeros can be ignored after the sign bit is separated. For example,
1000101.11 = - 101.
While the sign-magnitude representation of signed numbers appears to be natural extension of the traditional arithmetic, the arithmetic operations with signed numbers in this form are not that very convenient, either for implementation on the computer or for hardware implementation. There are two other methods of representing signed numbers.
Diminished Radix Complement (DRC) or (r-1)-complement Radix Complement (RX) or r-complement
When the numbers are in binary form
Diminished Radix Complement will be known as “one’s-complement” Radix complement will be known as “two’s-complement”.
If this representation is extended to the decimal numbers they will be known as 9’s- complement and 10’s-complement respectively.
One’s Complement Representation
Let A be an n-bit signed binary number in one’s complement form.
The most significant bit represents the sign. If it is a “0” the number is positive and if it is a “1” the number is negative.
This relationship can be used to determine one’s complement representation of negative decimal numbers.
Example 1 : What is one’s complement binary representation of decimal number -75?
Decimal number 75 requires 7 bits to represent its magnitude in the binary form. One additional bit is needed to represent the sign. Therefore,
one’s complement representation of 75 = 01001011 one’s complement representation of -75 = 10110100
Two’s Complement Representation
Let A be an n-bit signed binary number in two’s complement form.
The most significant bit represents the sign. If it is a “0”, the number is positive, and if it is “1” the number is negative. The remaining (n-1) bits represent the magnitude, but not as a simple weighted number.
Consider the following two’s complement numbers and their decimal equivalents:
0111111 + 63 0000110 + 6 0000000 + 0 1111010 - 6 1000001 - 63 1000000 - 64
There is only one representation of “0”, namely 000....0.
From these illustrations we observe
If most significant bit (MSD) is zero the remaining (n-1) bits directly indicate the magnitude.
If the MSD is 1, the magnitude of the number is obtained by taking the complement of all the remaining (n-1) bits and adding a 1.
Consider the two’s complement representation of -6.
We assume we are representing it as a 7-bit number. Leave the sign bit. The remaining bits are 111010. These have to be complemented (that is
In the example shown above a 7-bit number can cover the range from +63 to -64. In general an n-bit number has a range from + (2n-1^ - 1) to - (2 n-1^ ) with one representation for zero.
The representation also suggests that if A is an integer in two’s complement form, then
Two’s complement of A = -A
Two’s complement of a number is obtained by complementing all the digits and adding ‘1’ to the LSB.
This relationship can be extended to fractions as well.
If A = 0.101 (+0.625) 10 , then the two’s complement of A is 1.011, which is two’s complement representation of (-0.625) 10.
Similarly consider the case of a mixed number.
A = 010011.0101 (+19.3125) 10 Two’s complement of A = 101100.1011 (- 19.3125) 10
This relationship can be used to determine two’s complement representation of negative decimal numbers.
Example 2 : What is two’s complement binary representation of decimal number -75?
Decimal number 75 requires 7 bits to represent its magnitude in the binary form. One additional bit is needed to represent the sign. Therefore,
Two’s complement representation of 75 = 01001011 Two’s complement representation of -75 = 10110101
M1L1: Number Systems Problems