REPRESENTATION OF NUMBERS
The major type of data that computers deal with are numbers. All numbers in the binary
system are formed using the binary digits 0 and 1. Each number can be represented as
unsigned or signed binary number.
Unsigned Binary Numbers:
These are numbers that don’t include negative numbers.
Ex: (1011)2 = ( ? )10
Signed Binary Numbers:
Positive integers and the number zero can be represented as unsigned numbers. To
represent negative integers, we need a notation for negative values.
There are three different ways to represent signed binary numbers:
1. Signed-Magnitude representation
2. Signed-1's Complement representation
3. Signed-2's Complement representation
Signed-Magnitude Representation:
In ordinary arithmetic, a negative number is indicated by a minus sign and a positive
number by a plus sign. Because of hardware limitations, computers must represent
everything with 0’s and 1’s, including the sign of a number.
It is customary to represent the sign with a bit placed in the leftmost position of the
number. The convention is to make the sign bit 0 for positive numbers and 1 for
negative numbers.
Ex: +1= Ex: +7=
- 1= - 7=
Signed-Complement Representation:
When arithmetic operations are to be performed, negative numbers are represented by
their complements; r's complement and (r − 1)'s complement.
8
COMPLEMENTS
Complements are used in digital computer for simplifying the subtraction operation and
for logical manipulation.
There are two types of complements for each base-r system:
1. Radix (r 's) complement
2. Diminished radix (r − 1 's) complement
Diminished Radix (r − 1 's) Complement:
The (r − 1)’s complement of an n-digit number N is obtained by subtracting it from
rn − 1, [(rn − 1) − N].
For decimal numbers r = 10 and r − 1 = 9:
Ex: Find 9’s complement of 73.
Ex: Find 9’s complement of 1849.
For binary numbers, r = 2 and r − 1 = 1. Since 1 − 0 = 1 and 1 − 1 = 0, (r − 1)’s
complement is obtained by reversing the bits.
Ex: Find 1’s complement of (11010)2.
9
Radix (r's) Complement:
The r’s complement of an n-digit number N in base-r is obtained by subtracting it from
rn, [rn − N], if N ≠ 0 and it is 0 for N = 0.
r’s complement is obtained by adding 1 to the (r − 1)’s complement.
For decimal numbers r = 10:
Ex: Find 10’s complement of 2389.
Ex: Find 10’s complement of 0123.
10
For binary numbers r = 2:
Ex: Find 2’s complement of (0110111)2.
Ex: Find 2’s complement of (110110)2.
The complement of the complement is the original number.
11