Saturday, November 06, 2010

Signed and Unsigned Numbers

A binary number may be positive or negative. Generally, we use the symbol “+” and “-” to represent positive and negative numbers, respectively. The sign of a binary number has to be represented using 0 and 1, in the computer. An n-bit signed binary number consists of two parts – sign bit and magnitude. The left most bit, also called the Most Significant Bit (MSB) is the sign bit. The remaining n-1 bits denote the magnitude of the number.

In signed binary numbers, the sign bit is 0 for a positive number and 1 for a negative number. For example, 01100011 is a positive number since its sign bit is 0, and, 11001011 is a negative number since its sign bit is 1. An 8-bit signed number can represent data in the range -128 to +127 (-27 to +27-1). The leftmost bit is the sign bit.

In an n-bit unsigned binary number, the magnitude of the number n is stored in n bits. An 8-bit unsigned number can represent data in the range 0 to 255 (28= 256).

Complement of Binary Numbers


No comments:

Post a Comment