# Binary Representation of Integers

- In all number system both positive and negative numbers are possible.
- A conventional method of denoting these values is to use a (+) plus or (-) minus sign preceding the number.
- This representation is called signed number.
- Generally an additional bit, known as the sign bit, is placed at the most significant end to represent the sign 0 and 1 are used to indicate positive and negative respectively.
- They are of three types, namely
- Sign and Magnitude Representation
- One's complement
- Two's complement

# Sign and Magnitude Representation

- The simplest signed number system is the sing and magnitude notation often referred to as signed binary
- An n-bit number employs the MSB to represent the sign of the number ad the remaining n-1 bits to express the magnitude in binary.
- As an example, consider -1310 expressed using five bits.
- We have
- -13
_{10 }= 1.1101

(Sign bit of -)

- -13
- In this representation, a comma has been used to separate the sign bit from the magnitude bits for clarity.
- A positive number is represented as

+27_{10 }= 0,11011_{2}

# One's Complement

- One's complement represents positive numbers and negative numbers.
- Hence the value of +2 and -2 will be represented as 0010 in binary form.
- For example convert the given number using one's complement

-3 (convert number in the positive format)

+3 = 0000 0011 (8 bit form)

In 1's complement +3= 11111100

- Hence the result of -3 is 11111100
_{2â€‹}

Note: The simple method to convert the given value into one's complement is change all the given 1 as 0(zero) and 0 as 1 in the given value. |

# Two's Complement

- In a binary computer, one practical choice of the complementation constant R is as a power of 2.
- Since the radix of the system is 2 and R should be less than or equal to the radix, the obvious choices of complementation constants become 1 and 2.
- To convert the value in to two's complement first make the given 8bit digit into one's complement and add 1 to the LSB.
- For example convert -4 using two's complement.

4 = 0000 0100

Change to one's complement = 1111 1011

Add one to LSB __ 1__

__11111100__

- Hence the result of -4 is 11111100
_{2}