Chapter 3: Number System
Chapter 3: Number System
The decimal number system with which everyone is familiar uses the number 10 as its base
or radix and has 10 symbols or digits 0-9. For example, a decimal number X is written as
an an-1… a1 a0.a-1a-2… a-m, where as are one of 10 possible digits.
The standard form (general form) and usual interpretation of this number is:
= ∑ ai x 10i
i= -m
Example:
The general form of the decimal number 852.37 is equal to
8x102 +5 x101+ 2x100 +3x10-1 + 7x10-2
Likewise, substituting any base in place of 10 will give the general form of a number to
that radix or base.
In general, the standard form of a number (anan-1an-2…a1a0)m where n, n-1, n-2, …1 and 0 is
the position or weight of the digits an, an-1, an-2, … a1, and a0 respectively and m is the base of
the number is equal to:
an x mn + an-1 x mn-1 + an-2 x mn-2 + … + a2 x m2 +a1 x m1+a0 x m0
Example
(3462)8=3x83 + 4x82 + 6x81 + 2x80
In computer science, there are four commonly used bases - namely: base 2, base 8, base 10
and base 16. And the number systems in these bases are binary, octal, decimal and
hexadecimal respectively. The following table summarizes these bases, their respective
number systems and the possible digits (symbols) for each base.
1|Page
Base Number System Possible Symbols(digits)
2 Binary 0 and 1
8 Octal 0-7
10 Decimal 0-9
16 Hexadecimal 0-9 and A-F
Summary of Number systems
Note that: base n number system has n possible digits and the digits are 0 to n-1
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Equivalence of the number systems
Solution
(101.1)2 = 1x22 + 0x21 +1x20+1x2-1
= 1x4 + 0x2 + 1x1 + 1x ½
= 4 + 0 + 1 + 0.5
= 5.5
b) (101011)2
Solution
(101011)2=> 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
(43)10
c) (724)8
3|Page
Solution
(724)8 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
(468)10
d) (ABC)16
Solution
(ABC)16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
(2748)10
Note: A number expressible with finite number of digits in one base may
not necessarily transform into a finite number of digits in another bases
4|Page
A decimal number might have two parts: integral (left of the point) and fractional (to the
right of the point) parts. Converting these two parts from base 10 to any other base
involves the following steps:
Step 1. Converting the integral part of the decimal into integral part in the desired base
Step 2. Convert the fractional part of the decimal to a fractional number part in the
desired base
Step 3. The number in the desired base consists of the integer obtained in step 1 followed
by a base point (dot) and then followed by the fractional number part obtained in step 2
Step 1 Explained:
To convert a decimal integer to a base B integer number
1. Divide the given integer by the base B
2. Repeat step 1 until a 0 quotient is obtained, using at each stage the quotient from the
previous stages as dividend and the base B as divisor.
The successive remainders (starting from the least significant end) are the successive
digits of the number in base B
Example: Convert
a) 125 to binary
Solution
5|Page
(125)10 = 2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1
(125)10 = (1111101)2
b) 1234 to Octal
Solution
(1234)10 =
8 1234
8 154 2
8 19 2
8 2 3
0 2
1234 = (2322)8
c) 1234 to hexadecimal
Solution
6|Page
(1234)10 =
16 1234
16 77 2
16 4 13 = D
0 4
1234 = (4D2)16
Step 2 Explained:
To convert a decimal fraction to a fraction in base B
1. Multiply the given decimal fraction in base B
2. Repeat step 1 using the multiplicand at each step the remaining fractional part
from the previous step until a fractional part is identically 0, or until as many
digits as desired have been generated. The successive integral parts are the
successive digits of the number in base B starting from the most significant end.
Example: convert the following decimal numbers to binary
a) 3.14579
7|Page
.14579
x 2
3.14579 0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
11.001001... etc.
b) (.65)10 to binary
Solution
.65 x 2 = 1.3
.30 x 2 = 0.60
.60 x 2 = 1.20
.20 x 2 = 0.40
.40 x 2 = 0.80
.80 x 2 = 1.60
.60 x 2 = 1.20
.
.
. ____
Ans: (101001)
8|Page
o you can add 0’s on the right for fractional part and left for the integral part, if
necessary, to form a complete triplet
Example: Convert the following binary numbers to octal
a) (1011010111)2
Solution
1 3 2 7
(1011010111)2 = (1327)8
b) (110 011.010 110)2 = (63.26)8
Octal-to-Binary
Write the binary triplets for each octal digits
Example: Convert the following octal numbers to binary
a)(705)8 =
7 0 5
(705)8 = (111000101)2
Binary-to-Hexadecimal
Group the binary digits in quadriplets (four bits) starting at the binary point to the right
and to the left and convert each of these quadriplets to its hexadecimal equivalent
o you can add 0’s on the right for fractional number or left for integral number,
if necessary, to form a complete quadriplets
Example: convert the following binary number to hexadecimal
9|Page
a)(1010111011)2 = 10 1011 1011
2 B B
(1010111011)2 = (2BB)16
b) (11 0011.0101 10)2 = (33.58)16
c) (11 1100 1011.1001 1)2 = (3CB.98)16
Hexadecimal-to-Binary
Write the binary quadruplet for each hexadecimal digits
Example: convert the following hexadecimal numbers to binary
a)(10AF)16 1 0 A F
=
(10AF)16 = (0001000010101111)2
10 | P a g e
1 0 7 6
2 3 E
10768 = 23E16
Hexadecimal-to-Octal
This is equivalent to converting hexadecimal-to-binary and then to-octal
Example: convert (1F0C) 16 to octal
Solution
(1F0C) 16 =
1 F 0 C
1 7 4 1 4
(1F0C)16 = (17414)8
11 | P a g e
Remark: when you convert signed number, ignore the sign during conversion. After the
number in the desired base has been obtained, affix the sign of the original number to the
desired number
Example: convert (-125)10 to base 5
Solution
(125)10 = (1000)5
=> (-125)10 = (-1000)5
Note: before you start converting a number to a specified base, check whether the given
number is valid one or not. If it is not, do not try to convert.
Example: (230)2 is illegal and same is true for (98)8
Miscellaneous Examples:
12 | P a g e
y = 5 or y = -7
Therefore, since the base cannot be negative, the answer is y = 5
Exercise: For the following exercises, convert from the given base to the required base.
13 | P a g e