Number System and Complements
Number System and Complements
Number System and Complements
is equal to
• For Example
n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
2 22=4 10 210=1024 Kilo
3 23=8 11 211=2048
4 24=16 12 212=4096
5 25=32 20 220=1M Mega
14
Number Conversions - Decimal to Other Base System
The last remainder thus obtained will be the Most Significant Digit
(MSD) of the new base number.
Number Conversions - Decimal to Other Base System
Example - 5628 = ?2
1111012 = ?16
Step 1: Divide the binary digits into groups of four starting from the right
0011 1101
Step 2: Convert each group into a hexadecimal digit
00112 =0x 23 + 0 x 22 + 1 x 21 + 1 x 20 = 310
=316
11012 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = 1310
= D16
Hence, 1111012 = 3D16
Shortcut Method for Converting a Hexadecimal Number to
its Equivalent Binary Number
Example
2AB16 = ?2
Step 1: Convert each hexadecimal digit to a 4 digit binary
number
216 = 210
A16 = 1010 = 10102
2 A B
and
= r2 + 2r + 1
to find r solve quadratic equation
r2 + 2r + 1 = 100
r +1= 10
r=9
1)
It is clear from above example that (r-1)’s complement of any r-base number is
find out by subtracting each digit from (r-1)
31
Complements of r-base Number system
Example for 7-digit octal numbers:
Observation:
Subtraction from (rn – 1) will never require a borrow.
Diminished radix complement can be computed digit-by-digit.
For binary: 1 – 0 = 1 and 1 – 1 = 0.
32
Complements of r-base Number system
The Radix Complement - r’s Complement
The r's complement of an n-digit number N in base r is defined as
rn – N for N ≠ 0 and as 0 for N = 0.
since rn – N = [(rn 1) – N] + 1.
33
The 2's complement of 1101100 is 0010100
Example: Base-2
Subtraction with Complements
The subtraction of two n-digit unsigned numbers M – N in
base r can be done as follows:
34
Subtraction with Complements
Example
Using 10's complement, subtract 72532 – 3250.
Example
Using 10's complement, subtract 3250 – 72532.