### Wednesday, December 26, 2012

# 1's Complement

In mathematics, negative numbers in any base are represented by prefixing them with a − sign (negative sign). However, in computer hardware, numbers are represented in binary without any extra symbols, requiring a method of encoding the minus sign. In computing, 1's complement is one of the method to represent the negative numbers. However, 2's complement is dominant today. 1's complement could not have widespread use because of issues like negative zero, end-around borrow, etc.

Click here to know about 2's complement.

__Methods to find 1's complement__**Arithmetic Method**

We can find 1's complement by using the formula below:

where n = number of bits per word

N is a positive integer for which we have to find 1's complement

R is -N in 1's complement notation

Example 1: With an 8-bit word and N = 9, we have:

R = (2

^{8}-1) - 9 = 255 - 9 = 249 = 1111 1001**Binary Method**

To find the 1's complement is to simply take the bit by bit complement of the binary number.

For example:

**N = +6 = 0 0 0 0 0 1 1 0**

**R = -6 = 1 1 1 1 1 0 0 1**

Note: Given 1's complement, we can find the magnitude of a number by taking its 1's complement.

__(r-1)'s complement__
Formula to find (r-1)'s complement, where r is the base or radix (i.e. for decimal numbers r =10, for binary r =2, for hexadecimal number r =16, for octal number r =8)

**(r-1)'s complement of N = (r**

^{n}- r^{-m}- N)
where r = base

n = number of digits in the integer part of N

m = number of digits in the fractional part of N

Example 2: Find the 1's complement of (0.0110)

_{2}
(2-1)'s complement of (0.0110)

_{2}= (2^{0}- 2^{-4}- 0.0110)
= (0.1111 - 0.0110)

= (0.1001)

_{2}_{}

Subscribe to:
Post Comments (Atom)

nice

ReplyDelete