Signed Numbers in Binary System
In mathematics, we discuss the numbers in two categories:
Signed number, unsigned number
Unsigned number or positive number are started from zero that’s why we cannot put +ve sign in front of them to show that they are positive.
In signed number or negative number we use –ve sign in front of them to show that they are negative number.
But in binary number we cannot use any sign in front of any positive or negative numbers because in binary number we use two digits (0’s or 1’s) to represent any data or information. When these digits are use together then they are called bit. These bits also have some range in the form of byte or word. When 8-bits use together then they are represented as 1-byte and it’s ranging from 0 to 255 (000000002 to 111111112) that is 2^8 = 256 Different combination of bits formatting a signed 8-bit byte.
Example: unsigned binary number
010011012 = 64+8+4+1 = 7710
In mathematics we use sign to show the difference between signed or negative number (-) and unsigned or positive number (+).
Example: 12, -33, 121, 11, -223. Representing number in this type is known as “sign-magnitude”.
Sign magnitude notation is the method of representing signed or unsigned number either side of zero. To represent negative number we use (-) sign in front of number and to represent positive number we use (+) sign in front of number.
Example: -11 and +11, -34 and +34 etc.
We know computer only understand binary numbers and we cannot use negative or positive sign in front of binary numbers. We know binary number represent “0” and “1” and conveniently for us, sign also have two values “+” and “-”.
That’s why we use a sign bit to indicate the signed or unsigned value. For signed binary numbers the MSB (most significant bit) is used as the sign bit. Is the most significant bit or sign bit is “0” than it’s mean the number is positive in value and the remaining bits are used to represent the magnitude of the binary number in the formal unsigned binary number format way.
Example: positive signed binary numbers
Negative signed binary numbe
Disadvantage: we had a full range n-bit unsigned binary number, we now have an n-1 bit signed binary number.
-3(n-1) to +3(n-1)
Example: if we have 5 bit to represent a signed binary number, 1-bit for the sign bit and 3-bit for magnitude bits then the actual range of numbers we can represent in sign-magnitude notation are given bellow:
-3(5-1)-1 to +3(5-1)-1
-3(4)-1 to +3(4)-1
-13 to +13
the range of unsigned 5-bit binary number world have been from 0 to 15 or 0 to F in hexadecimal, we have reduced range is -13 to +13. Most significant bit is extra bit or digit rather than a used signed bit.
Example of signed binary number
Using sign magnitude format convert following decimal value into signed binary number
-1510 as a 6-bit number = 1011112
-5610 as a 8-bit number = 101110002
+2310 as a 6-bit number = 0101112
+8510 as a 8-bit number = 010101012