### Basics Electronics

Basics Electronics Education

Number System and Codes

# How the sign binary numbers ( 0,1) are represented? – 3 best ways to represent

#### Sign Binary Numbers

In the decimal number system, a plus (+) sign is used to represent a positive number were as a minus (-) sign used to represent the negative number. In Binary number system only 0 and 1 these two symbols are used to represent any binary number of any bit quantity.

When we required writing down the normal unsigned binary number we can write easily. But when we required writing the Signed binary number then we can’t write it because this number system uses only two symbols and these are 0 and 1 other symbols + or – are not available.

There are three popular methods are used to represent the sign binary numbers means to represent positive (+) and negative (-) binary numbers.

1. Sign magnitude representation method
2. 1’s complement (one’s complement ) method
3. 2’s complement ( Two’s complement ) method

#### Sign magnitude representation

The sign binary numbers represented using sign-magnitude representation. In the sign-magnitude representation system, the most significant bit MSB is used to represent the sign of a binary number. While remaining bits are used for the magnitude of a binary number. If the binary number is four bit MSB represents the sign and the remaining 3 bits show magnitude as shown in the following table.

 B3 (MSB) B2 B1 B0 Sign bit the magnitude of a number

In the sign-magnitude representation method, MSB represents the sign of a binary number. A 0 is used to represent a positive number and a 1 is used to represent a negative number.

The following table shows some examples of 4-bit numbers.

 Ex. Sign Magnitude +7 0 1 1 1 -7 1 1 1 1 -5 1 1 0 1 +5 0 1 0 1 – 3 1 0 1 1

The following table shows some examples of 8-bit numbers.

 Ex. Sign Magnitude +9 0 0 0 0 1 0 0 1 -12 1 0 0 0 1 1 0 0 -15 1 0 0 0 1 1 1 1 +15 0 0 0 0 1 1 1 1 – 127 1 1 1 1 1 1 1 1 +127 0 1 1 1 1 1 1 1

In the four-bit number system, 0111 i.e. +7 is the maximum positive number and a number 1111 -7 is the maximum negative number. Here 0 is used for +ve sign and 1 is used for –ve sign.

In the case of 8 bit (unsigned) binary number the decimal range is from 0 to 255, but for sign-magnitude representation ( sign binary number ) the largest magnitude reduced from 255 to 127 because we need to represent both positive and negative numbers.

Therefore if we represent the sign binary numbers by using sign-magnitude representation.

Maximum 8 bit positive number is 0111 1111 = +127

Maximum 8 bit negative number is 1111 1111 = -128

The Disadvantage of Sign Magnitude representation is it reduces the length of natural binary number to Half.

#### 1's Complement representation

The sign binary numbers can be represented using 1’s complement representation. In a binary number if each one is replaced by 0 and each 0 is replaced by one the resulting number is known as 1’s complement of the first number.

The positive numbers are shown similar to the sign-magnitude representation corresponding negative number is shown by its complement.

For example.  0011 represents +3 whereas 1100 represents -3

Note that even in this sign representation ‘0’ at the most significant bit (MSB) shows a positive (+) number and while 1 at the most significant bit (MSB) shows a negative number.

In Sign binary number the One’s complement of + positive number represents its – negative number.

The following table shows examples of 1’s complement method used to represent sign binary numbers.

 +3 0 0 1 1 -3 1 1 0 0 +5 0 1 0 1 -5 1 0 1 0 +7 0 1 1 1 -7 1 0 0 0

In digital electronics for addition, the adder circuit is used and for subtraction, the sub-tractor circuit is used.

Hereby using 1’s complement representation method the subtraction is possible by addition method because 1’s complement of an original number is its opposite number. So the subtraction can be done by using the adder circuit and it reduces the hardware.

The subtraction by using the addition method is possible shown by the following equation.

A – B = A + (-B)

#### 2's Complement representation

The sign binary numbers can be represented using 2’s complement representation. The 2’s complement can easily find out but for that need to know the 1’s complement of a  binary number. the 2’s complement can be shown by an equation.

2’s complement  = 1’s complement + 1

If  1 is added to the one’s complement of a binary number the resulting number is known as 2’s complement of the binary number. ( sign binary number)

The number 0011 represents +3 number in decimal. Whereas its 2’s complement 1101 represents -3 number in decimal by using 2’s complement representation method of the sign binary number.

In the 2’s complement representation method, the positive sign binary number is similar to sign-magnitude representation. While its 2’s complement represents the negative sign binary number.

The two’s complement of +N give –N and 2’s complement of –N gives +N

In this 2’s complement representation type of sign binary number, 0 at MSB shows a positive number. And  1 at MSB shows the negative number.

The following table shows some examples of 2’s complement representation method of sign binary number.

 Binary Number 0 0 1 1 1’complement 1 1 0 0 +1 +1 2’s complement 1 1 0 1 Binary Number 0 1 0 1 1’complement 1 0 1 0 +1 +1 2’s complement 1 0 1 1 Binary Number 1 0 1 0 1’complement 0 1 0 1 +1 +1 2’s complement 0 1 1 0

The following points are noted about 2’s complement method.

• 2’s complement of the 2’s complement of a binary number is the same number itself.
• If the Least significant bit LSB  of number is 1 then 2’s complement is obtain by changing 0 to 1 and 1 to 0 except the LSB.
• If the Least significant bit LSB of number is 0 then 2’s complement obtain by adding 1 to the 1’s complement.

Hereby using 2’s complement representation method the subtraction is possible by addition method because 1’s complement of an original number is its opposite number. So the subtraction can be done by using the adder circuit and it reduces the hardware.

The subtraction by using the addition method is possible shown by the following equation.

A – B = A + (-B)

#### Summary

As mentioned above if we need to use the Sign binary numbers then there are three popular methods of representation.

• Sign magnitude representation
• 1’s complement representation
• 2’s complement representation

The Sign magnitude representation method uses a bit at MSB to show the sign. A ‘0’  at MSB shows positive sign whereas a ‘1’ at MSB shows Negative sign.

This method is not used because it reduces the length of natural binary number to half.

The 1’s complement method is easy to represent the sign binary number. In this 0 is replaced by 1 and 1 is replaced by 0.

The 2’s complement method is also easy and convenient to represent the sign binary number. If 1 is added to 1’s complement of a binary number then the resulting number is known as 2’s complement of binary number.

error: Content is protected !!