Positive numbers ( including zero ) can be represented as unsigned number. However to represtnt negative integers we need a notation for negative values. In ordinary arithmetic, a negative number is indicated by minus sign and a positive number by plus sign. Because of hardware limitations, computer must represent everything with binary digits.
A bit placed in the leftmost position of the number (i.e. MSB) is used to represent the sign. Bit '0' is used for positive and bit '1' is used for negative sign.
example:
- 01001 can be considered as 9 ( unsigned binary) or (+9) signed binary because the leftmost bit is '0'.
- 1001 can be represented as 25 when considered as unsigned number and the binary equivalent of (-9) when consideered as signed number. This is because the '1' that is in the leftmost position designates a negative and other four bits represent binary '9'.
No comments:
Post a Comment