0% found this document useful (0 votes)
4 views15 pages

Numbers Systems - Examples

The document provides an overview of various number systems, including decimal, binary, octal, and hexadecimal, detailing their structure, place values, and conversion methods. It includes examples of converting numbers between these systems and explains how to find decimal equivalents and perform conversions for both integer and fractional parts. The lecture is part of a digital techniques course led by lecturer Hayder Sahib.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views15 pages

Numbers Systems - Examples

The document provides an overview of various number systems, including decimal, binary, octal, and hexadecimal, detailing their structure, place values, and conversion methods. It includes examples of converting numbers between these systems and explains how to find decimal equivalents and perform conversions for both integer and fractional parts. The lecture is part of a digital techniques course led by lecturer Hayder Sahib.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Lecture Two

Number Systems

2.1. Decimal Number System


 The decimal number system is a radix-10 number system and therefore has
10 different digits or symbols. These are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. All
higher numbers after ‘9’ are represented in terms of these 10 digits only.
 The place values of different digits in a mixed decimal number, starting
from the decimal point, are 100, 101, 102 and so on (for the integer part) and
10−1, 10−2, 10−3 and so on (for the fractional part).
 The value or magnitude of a given decimal number can be expressed as the
sum of the various digits multiplied by their place values or weights.

Example: 453 (4 Hundred, 5 Tens, 3 Units)


The lest significant bit (LSB)
The most significant bit (MSB)
453 = 3×100 +5×101+4×102
= 3+50+400
= (453)10

Example: 3586.265

3586. 265 = 6×100 +8×101+5×102 +3×103 + 2×10−1+6×10−2 +5×10−3

= 6 + 80 + 500 + 3000 + 0.2 +0.06 + 0.005 = (3586.265)10

Example: 2754.214

2754.214= 4×100 + 5×101+7×102 + 2×103 + 2×10−1+ 1×10−2 +4×10−3

= 4 + 50 + 700 + 2000 + 0.2 +0.01 + 0.004= (2754.214)10

Lecture 2 Digital Techniques lecturer: hayder sahib 1


2.2. Binary Number System
 The binary number system is a radix-2 number system with ‘0’ and ‘1’ as
the two independent digits.
 All larger binary numbers are represented in terms of ‘0’ and ‘1’.
 Starting from the binary point, the place values of different digits in a mixed
binary number are 20, 21, 22 and so on (for the integer part) and 2 −1, 2−2, 2−3
and so on (for the fractional part).

2.3. Octal Number System


 The octal number system has a radix of 8 and therefore has eight distinct
digits.
 All higher-order numbers are expressed as a combination of these on the
same pattern as the one followed in the case of the binary and decimal
number systems.
 The independent digits are 0, 1, 2, 3, 4, 5, 6 and 7.
 The next 10 numbers that follow ‘7’, for example, would be 10, 11, 12, 13,
14, 15, 16, 17, 20 and 21.
 The place values for the different digits in the octal number system are 80,
81, 82 and so on (for the integer part) and 8−1, 8−2, 8−3 and so on (for the
fractional part).

2.4. Hexadecimal Number System


 The hexadecimal number system is a radix-16 number system and its 16
basic digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.
 The place values or weights of different digits in a mixed hexadecimal
number are 160, 161, 162 and so on (for the integer part) and 16−1, 16−2, 16−3
and so on (for the fractional part).
 The decimal equivalent of A, B, C, D, E and F are 10, 11, 12, 13, 14 and 15
respectively, for obvious reasons.
 The table (1) shows the relationship between the hexadecimal, decimal, and
binary. Note that each hexadecimal digit represents a group of four binary
digits

Lecture 2 Digital Techniques lecturer: hayder sahib 2


Table (1)
2.5. Finding the Decimal Equivalent Dec. Hex. Binary
 The decimal equivalent of a given number in 0 0 0000
another number system is given by the sum of all 1 1 0001
the digits multiplied by their respective place 2 2 0010
values. 3 3 0011
 The integer and fractional parts of the given 4 4 0100
5 5 0101
number should be treated separately.
6 6 0110
7 7 0111
 Binary-to-Decimal Conversion 8 8 1000
9 9 1001
Example: convert the following binary numbers to their 10 A 1010
equivalent decimal numbers: 11 B 1011
1) (11011)2 12 C 1100
2) (1001)2 13 D 1101
3) (0.1011)2 14 E 1110
15 F 1111
4) (1011.0101)2
Solution:
1) 1 1 0 1 1 = 1*20 + 1*21 + 0*22 + 1*23 + 1*24
= 1 + 2 + 0 + 8 + 16
24 23 22 2120 = (27)
10

2) 1 0 0 1 = 1*20 + 0*21 + 0*22 + 1*23


=1+0+0+8
23 22 21 20 = (9)10

3) 0.1 0 1 1 = 1*2-1 + 0*2-2 + 1*2-3 + 1*2-4


1 1 1 1
-1 -2 -3 -4 =1* +0* +1* +1*
2 2 2 2 2 4 8 16
=0.5 + 0 + 0.125 + 0.0625
= (0.6875)10

4) 1 0 1 1 . 0 1 0 1 = 1*20 + 1*21 + 0*22 + 1*23 + 0*2-1 + 1*2-2 + 0*2-3 + 1*2-4


= 1 + 2 + 0 + 8 + 0 + 0.25 + 0 + 0.0625
= (11.3125)10

Lecture 2 Digital Techniques lecturer: hayder sahib 3


 Octal-to-Decimal Conversion
Example: convert the following octal numbers to their equivalent decimal
numbers:
1) (372)8
2) (24)8
3) (0.357)8
4) (137.21)8
Solution

1) (3 7 2)8 = 2 × 80 + 7 × 81 + 3 × 82
= 2 + 56 + 192 = (250)10
MSB LSB

2) (24)8 = 4 × 80 + 2 × 81
= 4 + 16 = (20)10

3) (0.3 5 7)8 = 3 × 8-1 + 5 × 8-2 + 7 × 8-3


3 5 7
= + +
8-1 8-2 8-3 8 64 512
192+40+7
=
512
239
=
512

= (0.466)10

4) (137.21)8 = 1 × 82 + 3 × 81 + 7 × 80 + 2 × 8−1 + 1 × 8−2


2 1
= 64 + 24+ 7 + +
8 64
= (95.265)10

 Hexadecimal-to-Decimal Conversion

Example: convert the following octal numbers to their equivalent decimal


numbers:
1) (356)16
2) (0.79B)16
3) (1E0.2A)16

Lecture 2 Digital Techniques lecturer: hayder sahib 4


Solution:

1) (3 5 6)16 = 6 × 160 + 5 × 161 + 3 × 162


= 6 + 5*16 + 3*256 = (854)10
MSB LSB

2) (0.7 9 B)8 = 7 × 16-1 + 9 × 16-2 + B × 16-3


7 9 11
-1 -2 -3
= + +
16 16 16 16 16∗16 16∗16∗16
1792+144+11
=
4096
1947
=
4096

= (0.475)10

3) (1E0.2A)16 = 1 × 162 + 14 × 161 + 0 × 160 + 2 × 16−1 + 10 × 16−2


2 10
= 256 + 224+ 0 + +
16 256
= (480.164)10

2.6. Decimal-to- Another number system Conversion


 As outlined earlier, the integer and fractional parts are worked on separately.
 For the integer part, the desired system can be found by successively
dividing the integer part of the number by n (base of system) and recording
the remainders until the quotient becomes ‘0’. The remainders written in
reverse order constitute the binary equivalent.
 For the fractional part, it is found by successively multiplying the fractional
part of the decimal number by n (base of system) and recording the carry
until the result of multiplication is ‘0’. The carry sequence written in
forward order constitutes the binary equivalent of the fractional part of the
decimal number.
 If the result of multiplication does not seem to be heading towards zero in
the case of the fractional part, the process may be continued only until the
requisite number of equivalent bits has been obtained.

 Decimal-to-Binary Conversion

Lecture 2 Digital Techniques lecturer: hayder sahib 5


Example: Convert the following numbers to their equivalent binary numbers.
1) (37)10
2) (0.8125)10
3) (0.6875)10
4) (13.375)10
Solution:
1) (37)10 = (?)2
37
= 18 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1
2

18
= 9 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 0
2

9
= 4 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1
2

4
= 2 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 0
2

2
= 1 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 0
2

1
= 0 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1
2

1 0 0 1 0 1

(MSB) (LSB)
(37)10 = (100101)2

2) (0.8125)10= (?)2
Result Integer Fraction
0.8125 * 2 = 1.6250 1 (MSB) 0.6250
0.625 * 2 = 1.2500 1 0.25
0.25 * 2 = 0.5000 0 0.5
0.5 * 2 = 1.0000 1 (LSB) 0
(0.8125)10= (0.1101)2

3) (0.6875)10 = (?)2

Lecture 2 Digital Techniques lecturer: hayder sahib 6


Result Integer Fraction
0.6875 * 2 = 1.3750 1 (MSB) 0.375
0.375 * 2 = 0.7500 0 0.75
0.75 * 2 = 1.5000 1 0.5
0.5 * 2 = 1.0000 1 (LSB) 0

(0.6875)10= (0.1011)2

4) (13.375)10 =(?)2

Integer part (13)10:


13
= 6 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1 (LSB)
2
6
= 3 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 0
2
3
= 1 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1
2
1
= 0 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1 (MSB)
2

Fractional part (0.375)10:


Result Integer Fraction
0.375 * 2 = 0.7500 0 (MSB) 0.75
0.75 * 2 = 1.5000 1 0.5
0.5 * 2 = 1.0000 1 (LSB) 0

(13.375)10 =(1101.011)2

 Decimal-to-Octal Conversion

Example: Convert the following numbers to their equivalent octal numbers.


1) (266)10
2) (65536)10
3) (0.467)10
4) (73.75)10

Solution:

Lecture 2 Digital Techniques lecturer: hayder sahib 7


1) (266)10 = (?)8
266
= 33 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 2
8

33
= 4 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1
8

4
= 0 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 4
8

4 1 2
(266)10 = (412)8 (MSB) (LSB)

2) (65536)10= (?)8
65536
= 8192 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 0 (LSB)
8
8192
= 1024 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 0
8
1024
= 128 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 0
8
128
= 16 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 0
8
16
= 2 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 0
8
2
= 0 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 2 (MSB)
8

(65536)10= (200000)8

3) (0.467)10 = (?)8
Result Integer Fraction
0.467 * 8 = 3.736 3 (MSB) 0.736
0.736 * 8 = 5.888 5 0.888
0.888 * 8 = 7.104 7 (LSB) 0.104
.
.
(0.467)10 = (0.357)8
4) (73.75)10 = (?)8

Lecture 2 Digital Techniques lecturer: hayder sahib 8


Integer part (73)10:

73
= 9 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1 (LSB)
8
9
= 1 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1
8
1
= 0 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1 (MSB)
8

Fractional part (0.75)10:


Result Integer Fraction
0.75 * 8 = 6.0 6 0

(73.75)10 = (111.6)8

 Decimal-to-Hexadecimal Conversion
Example: Convert the following numbers to their equivalent binary numbers.
1) (423)10
2) (0.4755)10
3) (82.25)10
Solution:

1) (423)10 = (?)16
423
= 26 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 7
16

26
= 1 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 10 (𝐴)
16

1
= 0 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 1
16

1 A 7

(MSB) (LSB)
(423)10= (1A7)16

2) (0.4755)10= (?)16

Lecture 2 Digital Techniques lecturer: hayder sahib 9


Result Integer Fraction
0.4755 * 16 = 7.6080 7 (MSB) 0. 6080
0. 6080 * 16 = 9.7280 9 0.7280
0. 7280 * 16 = 11.648 11(B) (LSB) 0. 648
.
.
(0.4755)10= (0.79B)16

3) (82.25)10 = (?)16
Integer part (82)10:

82
= 5 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 2 (LSB)
16
5
= 0 + 𝑟𝑒𝑚𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 5 (MSB)
16

Fractional part (0.25)10:


Result Integer Fraction
0.25 * 16 = 4.0 4 0
(82.25)10 = (52.4)16
2.7. Binary–Octal and Octal–Binary Conversions
 An octal number can be converted into its binary equivalent by replacing
each octal digit with its three-bit binary equivalent.
 A binary number can be converted into an equivalent octal number by
splitting the integer and fractional parts into groups of three bits, starting
from the LSB (from the right to the left) in case of integer numbers and
starting from the MSB (from the left to the right) in case of fraction
numbers. Then each group is converted to its equivalent octal number. The
0s can be added to complete the outside groups if needed.
Example: do the following conversions:
1) (472)8 = (?)2
2) (0.15)8 = (?)2
3) (374.26)8 = (?)2
4) (100111010)2 = (?)8
5) (1101)2 = (?)8
6) (0.111101)2 = (?)8
7) (1110100.0100111)2 = (?)8
Solution:

Lecture 2 Digital Techniques lecturer: hayder sahib 10


1) (4 7 2)8 = (?)2

100 111 010


(472)8 = (100 111 010)2

2) (0. 1 5)8 = (?)2

001 101
(0.15)8 = (0.001 101)2

3) (3 7 4 . 2 6)8 = (?)2

011 111 100 . 010 110


(374.26)8 = (011 111 100.010 110)2

4) ( 100 111 010 )2 = (?)8


4 7 2
(100 111 010)2 = (472)8

5) ( 1 101 )2 = (?)8

( 001 101 )2
1 5

(001 101)2 = (15)8

6) (0. 111 101)2 = (?)8


7 5
(0.111 101)2 = (0.75)8

Lecture 2 Digital Techniques lecturer: hayder sahib 11


7) ( 1 110 100 . 010 011 1 )2 = (?)8

( 001 110 100 . 010 011 100 )2


1 6 4 2 3 4

(001 110 100.010 011 100)2 = (164.234)8

2.8. Hex–Binary and Binary–Hex Conversions


 A hexadecimal number can be converted into its binary equivalent by
replacing each hex digit with its four-bit binary equivalent.
 A binary number can be converted into an equivalent hexadecimal number
by splitting the integer and fractional parts into groups of four bits, starting
from the LSB (from the right to the left) in case of integer numbers and
starting from the MSB (from the left to the right) in case of fraction
numbers. Then each group is converted to its equivalent hexadecimal
number. The 0s can be added to complete the outside groups if needed.

Example: do the following conversions:


1) (9F2)16 = (?)2
2) (0.F36)16 = (?)2
3) (17E.F6)16 = (?)2
4) (1110100110)2 = (?)16
5) (0.111100111011)2 = (?)16
6) (1011001110.011011101)2 = (?)16
Solution:

1) (9F2)16 = (?)2
(9 F 2)8 = (?)2

1001 1111 0010

(9F2)16 = (1001 1111 0010)2


2) (0.F36)16 = (?)2

Lecture 2 Digital Techniques lecturer: hayder sahib 12


(0. F 3 6)8 = (?)2

1111 0011 0110

(0.F36)16 = (0.1111 0011 0110)2

3) (17E.F6)16 = (?)2

(1 7 E . F 6)8 = (?)2

0001 0111 1110 . 1111 0110

(17E.F6)16 = (0001 0111 1110.1111 0110)2

4) ( 11 1010 0110 )2 = (?)16

(0011 1010 0110 )2


3 A 6

(0011 1010 0110)2 = (3A6)16

5) (0. 1111 0011 1011 )2 = (?)16


F 3 B

(0.1111 0011 1011)2 = (F3B)16

6) ( 10 1100 1110 . 0110 1110 1 )2 = (?)16

( 0010 1100 1110 . 0110 1110 1000 )2 = (?)16


2 C E 6 E 8

(0010 1100 1110.0110 1110 1000)2 = (2CE.6E8)16


2.9. Hex–Octal and Octal–Hex Conversions

Lecture 2 Digital Techniques lecturer: hayder sahib 13


 For hexadecimal–octal conversion, the given hex number is firstly converted
into its binary equivalent which is further converted into its octal equivalent.
 An alternative approach is firstly to convert the given hexadecimal number
into its decimal equivalent and then convert the decimal number into an
equivalent octal number.
 For octal–hexadecimal conversion, the octal number may first be converted
into an equivalent binary number and then the binary number transformed
into its hex equivalent.
 The other option is firstly to convert the given octal number into its decimal
equivalent and then convert the decimal number into its hex equivalent.
Example: Do the following conversions:
1) (2F.C4)16 = (?)8
2) (762.013)8= (?)16
Solution:
1)
(2F.C4)16 = (?)2

(2 F . C 4 )8 = (?)2

0010 1111 . 1100 0100

(2F.C4)16 =(0010 1111.1100 0100)2


(0010 1111.1100 0100)2 = (101 111 . 110 001 )2
5 7 6 1
(101 111.110 001)2 = (57.61)8.
2)
(762.013)8 = (?)2
(7 6 2 . 0 1 3)8 = (?)2

111 110 010 . 000 001 011

(762.013)8 = (111110010.000001011)2

Lecture 2 Digital Techniques lecturer: hayder sahib 14


( 1 1111 0010 . 0000 0101 1 )2

( 0001 1111 0010 . 0000 0101 1000 )2


1 F 2 0 5 8

(0001 1111 0010 . 0000 0101 1000)2= (1F2.058)16.

H.W: Covert the following numbers:


1. (614)8=(?)10
2. (100111101)2=(?)8
3. (569)10=(?)2
4. (975)10=(?)2=(?)8
5. (1010111011)2=(?)10=(?)8
6. (24CF)16=(?)10
7. (3117)10=(?)16=(?)2
8. (1001011110110101)2=(?)16=(?)10
9. (3527)8=(?)16
H.W: Convert the following numbers from the given base to the bases indicated:
1. (225.225)10 to Binary, Octal, Hex.
2. (11010111)2 to Binary, Octal, Hex.
3. (623.77)8 to Binary, Octal, Hex.
4. (2AC5.D)16 to Binary, Octal, Hex.
H.W: Write the next four numbers in these counting sequences:
1. (624, 625, 626, 627,------,------,------,------)8
2. (E9A, E9B, E9C, E9D,------,------,------,------)16

Lecture 2 Digital Techniques lecturer: hayder sahib 15

You might also like