0% found this document useful (0 votes)
83 views13 pages

Chapter 3: Number System

The document summarizes number systems and bases. It discusses: 1) Decimal, binary, octal, and hexadecimal number systems and their respective bases (10, 2, 8, 16) and symbols/digits (0-9, 0-1, 0-7, 0-9 and A-F). 2) The general form of a number in any base as the sum of the place value of each digit. 3) Algorithms for converting between different number bases, including dividing or multiplying by the new base to obtain digits in the desired base.

Uploaded by

DagneWalle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views13 pages

Chapter 3: Number System

The document summarizes number systems and bases. It discusses: 1) Decimal, binary, octal, and hexadecimal number systems and their respective bases (10, 2, 8, 16) and symbols/digits (0-9, 0-1, 0-7, 0-9 and A-F). 2) The general form of a number in any base as the sum of the place value of each digit. 3) Algorithms for converting between different number bases, including dividing or multiplying by the new base to obtain digits in the desired base.

Uploaded by

DagneWalle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 13

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:

10n… 101 100. 10-110-2... 10-m


An… a1 a0 . a-1 a-2 … a-m

Therefore, the general form of the given number is:

X= an x 10n + … + a1x101+a0x100 + a-1 x 10-1 + … + a-m x 10-m


n

= ∑ 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

Decimal Binary Octal Hexa-decimal

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

Conversion from One Base to Another


2|Page
A. Conversion of any-base Number to a Decimal Number
A number that is represented in any base can be converted to decimal using the following
steps:
Step 1. Represent the given number in its general form
Step 2. Using decimal arithmetic simplify the general form

Example: convert the following numbers to decimal


a) (101.1)2

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

B. Conversion from Base 10 to 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)

C. Some Simple Algorithms


Binary- to-Octal
Group the binary digits in triplets (three bits) starting at the binary point to the right and
to the left and convert each of these to its octal equivalent

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

(1011010111)2 = 1 011 010 111

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

111 000 101

(705)8 = (111000101)2

b) (63.26)8 = (110 011.010 110)2


c) (65.61)8 = (110 101.110 001)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
=

0001 0000 1010 1111

(10AF)16 = (0001000010101111)2

b) (33.58)16 = (0011 0011.0101 1000)2


c) (4E93)16 = (0100 1110 1001 0011)2
Octal-to-Hexadecimal
This is equivalent to converting octal-to-binary and then to-hexadecimal
Example: convert (1076)8 to hexadecimal

10 | P a g e
1 0 7 6

001 000 111 110

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

0001 1111 0000 1100

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:

1. Find the value of y if (123y)16= (11074)8


Solution
1x163 + 2x162 + 3x161 +yx160 = 1x84 + 1x83 +0x82 +7x81 +4x80
 1x4096 + 2x256 + 3x16 + yx1 = 4668
 4096 + 512 + 48 +y = 4668
 4656 + y = 4668
 y = 4668 – 4656
 y =12
 y=C

2. Find the value of y if (1110)3=(124)y


Solution
1x33 + 1x32 + 1x31 + 0x30 = 1xy2 + 2xy1 + 4xy0
 1x27 + 1x9 +1x3 + 0x1 = y2 + 2y + 4
 27 + 9 + 3 + 0 = y2 + 2y + 4
 y2 + 2y + 4-39 = 0
 y2 + 2y - 35 = 0
 (y – 5) (y + 7) = 0

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.

No. Question Answer


1. 192 to base 2 (11000000)2
2. 192 to base 8 (300)8
3. 192 to base 16 (C0)16
4. (1110.11)2 to decimal 14.75
5. (100010101110.11011101)2 to octal (4256.672)8
6. (100010101110.11011101)2 to hexadecimal (8AE.DD)16
7. (ABEBE)16 to decimal 704190
8. (ABEBE)16 to binary (10101011111010111110)2
9. (ABEBE)16 to octal (2537276)8
10. ( 256)2 to octal Not Applicable
11. (256.75)10 to binary (100001001.011)2
12. (256.75)10 to hexadecimal (109.6)16
13. (29y)16 = 672 y = 10

13 | P a g e

You might also like