# Signed Binary Numbers

- Muhammad Shahid
- m_shahid@live.co.uk
- 64 Views
- 0 Comments

### Signed Binary Numbers

The numbers used in real life for routine financial matters, numeric records, and in mathematical calculations, etc. are either positive or negative in sign. The positive numbers are usually unsigned and do not carry a **positive (+) sign**. Moreover, a number without any sign is understood to be a positive number. Contrary to this, a negative number is a signed number that is represented by a **negative sign (-)** on the leftmost side of the number e.g. -12345 or -12345_{10}.

The binary numbers, which are discussed in the previous articles, are unsigned binary numbers i.e. positive values only. As the architecture of digital systems and computers understand only binary numbers, the representation of real-life signed numbers in binary by a positive (+) or negative (-) sign is not possible. Because the binary numbers are represented by binary digits (bits) which can have a value of either “0” or “1” i.e. they can have only two numbers to represent a bit. The bit value either “0” or “1” is a mere representation of the logic level which is dependent on the digital circuit. That said, representation and understanding of any other number besides “0” and “1” are not possible at the hardware level of the digital system. Contrary to decimal numbers, it is not possible to include a negative sign with a binary number to represent a negative value.

### Sign-and-Magnitude

A number, essentially, should have two values i.e. **sign** and **magnitude** in order to represent positive and negative values. This representation is known as **Sign-and-Magnitude** (SM) notation. For example, a negative number (-12345) is represented by using this Sign-and-Magnitude (SM) notation. This method, Sign-and-Magnitude, is the simplest and most commonly used method to represent numbers both positive and negative. The Sign-and-Magnitude method can also be applied to binary numbers to represent negative and positive numbers. The binary number carrying a sign (positive or negative value) along with the magnitude is termed signed binary numbers.

The binary number is represented by only “0”s & “1”s and there is no provision to include (+) or (-) sign in order to use Sign-and-Magnitude notation. In order to adopt this Sign-and-Magnitude method, the most significant bit **(MSB)** is used as a sign to indicate the positive or negative value of the binary number. For representing, a **positive signed binary number a “0” is used** as a most significant bit, whereas, a **“1” represents a negative signed binary number**. Using this Sign-and-Magnitude notation, the most significant bit of a signed binary number holds the sign (positive or negative notation) and the rest of the bits represent the magnitude or value of the signed binary number.

The signed binary number having “n” number of bits uses one (1) bit to indicate the sign and “n-1” bits to represent the magnitude or value. Using the Sign-and-Magnitude notation, the positive and negative value of a decimal number (45) is represented below as a signed binary number. The decimal number can be converted to a binary value by using the repeated-division-by-2 method which is discussed in the previous article.

However, the Sign-and-Magnitude notation has a number of disadvantages. The usage of one (1) bit as a sign bit reduces the number of bits to hold the magnitude or value. In a comparison with an unsigned binary number having “n” number of bits, the signed binary number is going to have **“n-1”** bits to represent a value. The sign-and-magnitude notation splits the number values into two halves i.e. one on each side of zero (0). In order to understand this, the decimal ranges of unsigned and signed binary numbers are given below. The size of both unsigned and signed numbers is set to eight (8) bits.

The range of numbers for an eight (8) bit unsigned number is from **“0” to “255”** i.e. a total of 256 numbers that can be represented. Whereas, the signed binary number ranges from **“–127” to “127”** including the middle value of **“0”**. The number of values represented by the signed number is “255”. Likewise, for the 4-bit unsigned and signed binary numbers the decimal ranges are:

Similarly, the ranges for **4-bit** unsigned and signed binary numbers are (0 to 15 = 16) and (-7 to +7 = 15), respectively. Here, again, the sign-and-magnitude notation has reduced the number of values by one (1) compared to the equivalent unsigned binary number.

Besides, the sign-and-magnitude notation has two zero (0) values each representing a positive and negative zero. For example, a sign bit of “0” placed with a “0” value shows a positive zero i.e. 0000_{2}. Likewise, a sign bit of “1” placed with “0” values shows a negative zero i.e. 1000_{2}. According to sign-and-magnitude notation, both are valid and this occupies one of the number values discussed above.

### Signed Binary Number Examples

In the following table, a number of examples are given to represent both positive and negative decimal numbers with their equivalent signed binary numbers. The conversion from decimal to binary number is achieved by the application of the repeated-division-by-2 method.

In order to use **sign-and-magnitude notation**, the sign bit is placed at the most significant bit (MSB), whereas, the rest of the bits represent magnitude or value. If the magnitude or value is less and does not occupy all of the magnitude bits then the remaining magnitude bits are set to zero (0). This arrangement helps in identifying the sign bit’s location i.e. MSB of 8-bit, 16-bit, or 32-bit, etc.

### One’s Complement

The **One’s Complement** is another method to represent negative numbers of a signed binary number. The positive values remain unchanged and are, as such, called **non-complemented** values. The positive values are the same as shown for sign-and-magnitude positive values. However, the negative values are one’s complement that is inverted or negated. For example, the complement of “0” is “1” and of “1” is “0”. Therefore, the negative of a given positive signed binary number can be determined by taking one’s complement or changing “0”s to “1”s and vice versa. For example, the one’s complement of **10110011 _{2}** is

**01001100**In digital or logic circuits, one’s complement is achieved by using “

_{2}.**Inverters**“. The number of parallel inverters required is dependent on the size or length of the signed binary number (number of bits).

Similar to the sign-and-magnitude notation, the one’s complement has n-bit notation ranging from –(2^{n-1}-1) to (2^{n-1}-1) and has two values to represent a zero i.e. **0000 _{2} (positive)** and

**1111**for a 4-bit signed number.

_{2}(negative)### Addition and Subtraction using One’s Complement

The one’s complement can be used to **subtract** binary numbers. The addition of two binary numbers is achieved by using **Adder circuits** resulting in **Sum** and **Carry bits**. The Adder result depends on the values of the input values. In mathematics, the subtraction of numbers can be formulated as A + (-B) which is the addition of two numbers having inverted to be subtracted operand. Using this formulation, the subtraction of two binary numbers can be performed by using one’s complement on the desired operand. For example, the mathematical expression 108 – 45 = 63 is performed carried out using one’s complement.

The decimal numbers are converted into equivalent decimal numbers and both binary numbers are adjusted to 8-bits by adding leading zeroes.

In order to **subtract 45 _{10} from 108_{10}** using addition or adder, the one’s complement of 45

_{10}is determined by inverting its every bit. The equivalent binary of 45

_{10}is

**00101101**and its one’s complement is

_{2}**11010010**Now, this one’s complemented added to 108

_{2}._{10}= 01101100

_{2}gives the one’s complemented subtraction as shown below.

In the above result, the 9^{th} bit is an **overflow bit** and indicates subtraction resulted in a positive number. If subtraction results in no overflow bit then the result is a negative number. So, in this case of overflow, the 9^{th} bit or overflow bit can be **safely ignored**. Now, to convert this one’s complemented result into a real result, a “1” is added as shown below.

The subtraction using one’s complemented produced the result **(00111111 _{2})** which when converted to the equivalent decimal number is 63

_{10}. The equivalent decimal number of (00111111

_{2}) is determined using the sum of the weighted product i.e. (32+16+8+4+2+1) = 63. So, one’s complement can be used in binary adders such as

**74LS83**or

**74LS283,**etc. to subtract the signed binary numbers.

### Two’s Complement

The **two’s complement** is another method to represent the negative binary number in a signed binary number system. Just like **Sign-and-Magnitude** and **One’s Complement** methods, the positive binary numbers remain unchanged. Whereas, a negative number in two’s complement method is **one’s complemented plus (+) “1”** to the least significant bit (LSB). The negative binary number when added to its counterpart positive number results in zero. The two’s complement does not include the double zeros issue which was observed in Sign-and-Magnitude and One’s Complement methods. Further, it is much easier to obtain two’s complement making arithmetic operations relatively much easier. The range of two’s complement signed binary number is given below.

Using the previous example of one’s complement, the two’s complement of (45_{10} = 00101101_{2}) is obtained by first getting one’s complement and adding “1” to it i.e. (11010010_{2} + 00000001_{2} = 11010011_{2}).

The two’s complement of 45_{10} equals -45_{10} in a signed binary number. The subtraction (108_{10} – 45_{10}) is, thus, obtained by adding both signed binary numbers as shown below.

The** overflow bit is discarded** and the rest of the 8-bits constitute the subtraction result which is equivalent to (63_{10} = 32+16+8+4+2+1).

In the following table, a comparison of different methods to represent 4-bit signed binary numbers is shown.

### Conclusion

- The signed binary number system is used to represent both positive and negative numbers in binary. The methods used to represent signed binary numbers are Sign-and-Magnitude, One’s Complement, and Two’s Complement.
- The Sign-and-Magnitude uses the most significant bit (MSB) as a sign bit. The zero (0) shows a positive magnitude and a one (1) shows a negative magnitude of a binary number. The range of numbers is split into -127 to -0 and +0 to +127. The disadvantage involves double zeros i.e. 0000
_{2}and 1000_{2}. - In One’s Complement method, the positive numbers remain unchanged whilst the negative numbers are obtained by inverting each bit of its relevant counterpart positive. The range of numbers is split into -127 to -0 and +0 to +127. Similar to Sign-and-Magnitude, the One’s Complement has the disadvantage of having double zero in its range of numbers. The addition or adder can be used along with one’s complement to perform the subtraction of two binary numbers.
- The Two’s Complement has unaltered positive numbers just like Sign-and-Magnitude and One’s Complement methods. The negative number is obtained by first determining the one’s complement of the relevant positive number and then adding “1” to it. The range of numbers is -128 to 0 to +127 and includes only one zero in the range.
- The two’s complement is the most commonly used method to represent signed binary numbers compared to other presented methods. The usage of the two’s complement method avoids the issue of double zero and the arithmetic operations become relatively much easier.

Subscribe

Login

0 Comments