The Number System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

LESSON V

Representing Character and Values with Bytes

Contents
A. Digital Data Representation
B. Representing Numerical Data
a. The Binary Numbering System
Binary to Decimal Conversion System
Converting Binary Numbers w/ Integral and Fractional Part into its Decimal
Equivalent
MDAS Binary Operation
Binary Multiplication
Binary Division
Binary Addition
Binary Subtractions
b. Decimal to Binary to Decimal Number Systems
Decimal to Binary Conversion System
Converting Decimal Numbers w/ Integral and Fractional Parts into its Binary
Equivalent
c. Octal Numbering System
The Octal Number Base System
Octal to Binary Conversion
Binary to Octal Conversion
Octal to Decimal Conversion
Decimal to Octal Conversion
Addition of Octal Number System
Subtractions of Octal Number System
Octal to Hexadecimal
d. The Hexadecimal Number Base System
Hexadecimal to Binary Conversion
Binary to Hexadecimal Conversion
Hexadecimal to Decimal Conversion
Decimal to Hexadecimal Conversion
Hexadecimal to Octal
Addition of Hexadecimal
Subtraction of Hexadecimal
C. Coding Systems for Text-Based Data
a. ACCII and EBCDIC
b. Unicode
D. Coding Systems for other Types of Data
a. Graphics
b. Audio/Video

58 | P a g e
A. Digital Data & Program Representation

All data are representing by code. There are coding systems (also called coding schemes) that
are used to represent numeric, text-based, and multimedia data, as well as to represent computer
programs (software). In older days, the code used is Morse code, smoke signal and semaphore. Virtually
all computers today are digital computers used its own code. For the information, our computer only
recognizes two types of digits, which is 1 and 0. They are also called a bit as each 1 or 0 is one bit in the
binary system. 1 and 0 also represent on and off state and yes or no. representing data in digital form so
it can be used by a digital computer
There are three character codes to represent characters which are ASCII, EBCDIC and Unicode.
Each byte contains eight bits. A byte provides enough different combination of 0s and 1s to represent
256 characters.
Internally, computers represent all data using sequences of bits — pieces of memory that are
either 0 or 1. Since integers constitute the most important type of data that a computer manipulates,
we should understand how they are represented using bits. Understanding this is helpful in many ways,
such as understanding how to manipulate bits directly using the bit operators found in C, Java, and
many other programming languages.

Bit. The smallest unit of data a digital computer can recognize; represented by a 0 or a 1.
Byte. A group of 8 bits
Kilobyte (Kb). 1,024 bytes
Megabyte (Mb). Approximately 1 million bytes. 1,048,576
Gigabyte (GB). Approximately 1 billion bytes.
Terabyte (TB). Approximately 1 trillion bytes.
Petabyte (PB). Approximately 1,000 terabytes.
Exabyte (EB). Approximately 1,000 petabyte
Zettabyte (ZB). Approximately 1,000 exabytes.
Yottabyte (YB). Approximately 1,000 zettabytes.

The Number Systems

Number systems are number or styles of notations that represent quantities or numbers. These
are:

1. Binary System uses only 2 symbols, 0 and 1, and is mostly used for, computer applications.
2. Decimal System requires 10 different symbols. Hence, it is a base 10 number system. It is unusually
used
today in most applicants. Internally, computers represent all data using sequences of bits —
pieces of memory that are either 0 or 1. Since integers constitute the most important type of
data that a computer manipulates, we should understand how they are represented using bits.
Understanding this is helpful in many ways, such as understanding how to manipulate bits
directly using the bit operators found in C, Java, and many other programming languages.
3. Octal System base 8 number system which is used in computer systems.
4. Hexadecimal System base 16 number systems often used in assembly language programming.
5. Positional Notation is a system in which the value or magnitude of a number is defined not only
by its digits or symbol value, but also by its position. Each position represents a power of the
radix, or base, and is ranked in ascending or descending order
6. Most Significant Digit (MSD) is a digit within a number (whole or fractional) that has the largest
effect (weighing power) on that number.

59 | P a g e
7. Least Significant Digit (LSD) is a digit within a number (whole or fractional) that has the least
effect (weighting power) on that number.

B. Representing Numerical Data

a. The Binary Numbering System


Numbering system is a way of representing numbers. The numbering system that commonly use is called
the decimal numbering system because it uses 10 symbols – 7,216 is understood as 7 x 103 + 2 x 102 + 1 x
101 + 6 x 100 or 7,000 + 200 + 10 +6 or 7,216 . The binary numbering system uses only two symbols digits 0
and 1 – 1001 represents (1 x 23 + 0 x 22 + 0 x 21 + 1 x 20 or 8 + 1 or 9). In both systems, the position of each
digit determines the power, or exponents, to which the base number (10 for decimal and 2 for binary) is
raised.

Binary to Decimal Conversion System

To convert a base 2 numbers to base 10, you must know the decimal equivalent of each power
of 2. The decimal value of a power of 2 is obtained by multiplying 2 by itself the number of times
indicated by the exponent for whole numbers.

Rule: To obtain the decimal value of a binary number, add the powers of two (2) corresponding to
those bits of the number being converted whose value is one (1).

1. In converting binary into decimal my use the expanded notation. 1012 = ?10
2. Any number rise to zero (0) that is equal to (1). =
1x22+0x21+1x20
3. Before you will add the value of each binary digit, first raised to power of….then multiply. =
4+0+1
4. Afterwards, add all the value which is the result of the raising all power of each digit = 510

Exercises:

a. 1012 = ?10
=1X22+0X21+1X20
=4+0+1
=510

b. 101102 = ?10
= 1x24+0x23+1X22+1X21+0x20
= 16+4+2
= 2210

c. 1112 = ?10
= 1x22+1X21+1X20
= 4+2+1
= 710

d. 1101002 =?10
=1x25+1x24+0x23+1x22+0X21+0X20
=32+16+0+4+0+0
=5210

60 | P a g e
Note: Sometimes it is necessary to indicate a subscript of 2 to distinguish a binary number.

EXERCISES: For practice let’s convert these binary numbers to decimal:

1. 101102 = ?10 Ans. 2210


2. 10110112 = ?10 Ans. 9110
3. 1011101112 = ?10
4. 1112 = ?10 Ans. 710
5. 1101002 = ?10 Ans. 5210
6. 10110110012 = ?10 Ans. 72910
7. 101000112 = ?10 Ans. 16310

Converting Binary Numbers w/ Integral and Fractional Part into its Decimal Equivalent

The process of converting Binary numbers containing integral and fractional parts. The
expanded notation is still used, only this time we also consider the place values of the fractional part
which are the negative powers of two. For fractional numbers, the decimal value is equal to 1 divided
by 2 multiplied by itself the number of times indicated by the exponent.

Remember: any number to the 0 power is equal to 1 10

You may want to write the decimal equivalent for each position as we did in the following example.
Add only the values indicated by a 1.

Problem 1 0 1 1 0. 0 12

Decimal 16 8 4 2 1. .5 .25

Value: .25

2.

4.

16.

22.2510

The following examples illustrate the process of conversion:

a. 0.1012 = 1x2-1+0x2-2+1x2-3
=1/2+0+1/8
=0.5+0+0.125
=0.625
b. 11.0112 =1x21+1x20+0x2-1+1x2-2+1x2-3
=2+1+0+1/4+1/8
=3+0.25+0.125
=3.375
c. 101.10112 =1x22+0x21+1x20+1x2-1+0x2-2+1x2-3+1x2-4
=4+0+1+1/2+0+1/8+1/16
=5+0.5+0.125+0.0625
=5.6875

61 | P a g e
Therefore:

0.1012 = 0.62510
11.0112 = 3.37510
101.10112 = 5.687510

EXERCISES: For practice let’s convert these Binary Numbers with Integral to Fractional Parts into its
Decimal Equivalent.

1. 1101101.11112 = ?210 Ans. 109.937510


2. 0.10102 = ?10 Ans. 0.62510
3. 0.01012 = ?10 Ans. 0.312510
4. 10110.012 = ?10 Ans. 22.2510

MDAS Binary Operation


Binary Multiplication
The rule for decimal multiplication also holds for binary multiplication. In facts, binary
multiplication is simpler since multiplying a number by the bit 0 or 1 yields respectively 0 or the number.
In any number systems, multiplication consists of adding a number to itself as many times as is
specified by the multiplier. Most computers refer to a multiplication table stored in memory, thus
avoiding the time consuming process of repetitive addition. In actual practice binary multiplication
reduces to copying the multiplier digit is 0.
As in decimal multiplication, we shift one place to the left after obtaining each partial product,
and in the end add up all the partial products to obtain the answer.
The table for binary multiplication is very, with only four entries instead of the 100 necessary for
decimal multiplication. The binary multiplication table is…..

0*0=0
1*0=0
0*1=0
1*1=1

Multiplication is achieved by adding a list of shifted multiplicands according to the digits of the
multiplier.
Ex. (unsigned)

Ex. 1 (unsigned)

1 0 1 1 Multiplicand (4bits)
x 1 1 0 1 Multiplier (4bits)
1 0 1 1
0 0 0 0 0
1 0 1 1 0 0
1 0 1 1 0 0 0 placeholder
1 0 0 0 1 1 1 1 Product (8 bits)
Ex. 2

1 1 .0 0 Multiplicand (4bits)
x 1 0 .1 0 Multiplier (4bits)
0 0 0 0
1 0 0 0 0
0 0 0 0 0 0
1 1 0 0 0 0 0 placeholder
62 | P a g e
1 1 1 1 .0 0 0 0 Product (8 bits)

Ex.3

1011 (A)
×1010 (B)
---------
0000 ← Corresponds to a zero in B
+ 1011 ← Corresponds to a one in B
+ 0000
+1 0 1 1
---------------
=1101110

Binary numbers can also be multiplied with bits after a binary point:

1 0 1.1 0 1 (A) (5.625 in decimal)


× 1 1 0.0 1 (B) (6.25 in decimal)
-------------
1 0 1 1 0 1 ← Corresponds to a one in B
+ 0 0 0 0 0 0 ← Corresponds to a zero in B
+ 000000
+ 101101
+ 101101
-----------------------
= 1 0 0 0 1 1.0 0 1 0 1 (35.15625 in decimal)

Exercises: Test your binary math skills with these practice problems and exercises.

1. 102 x 102 = Ans. 1002


2. 1002x 112 = Ans. 11002
3. 1012 x 102 = Ans. 10102
4. 10112 x 112 = Ans. 1000012
5. 110112 x 1012 = Ans. 100001112

Binary Division

Rules:

1. In binary division we never need to try multipliers of the divisor to find the largest one that will go
into the dividend.
2. We are either able to subtract the divisor, in which case the quotient digit is 1, or we are not able
to subtract the divisor, yielding a quotient digit is 0.

NOTE: The division of binary fraction is handled the same ways as the division of decimal fractions; that
is, one convert the divisor to an integer by moving the binary point in both the divisor and the dividend
the same number of places.
The complete table for Binary Division:
0/1 = 0
1/1 = 1

Here, the divisor is 1012, or 5 decimal, while the dividend is 11011 2, or 27 decimal. The procedure is
the same as that of decimal long division; here, the divisor 1012 goes into the first three digits 1102 of the

63 | P a g e
dividend one time, so a "1" is written on the top line. This result is multiplied by the divisor, and subtracted
from the first three digits of the dividend; the next digit (a "1") is included to obtain a new three-digit
sequence:

Example # 1

1
___________
101 )11011
−101
-----
011

The procedure is then repeated with the new sequence, continuing until the digits in the dividend have
been exhausted:

101
___________
101 )11011
−101
-----
011
−000
-----
111
−101
-----
10

Thus, the dividend of 110112 divided by 1012 is 1012, as shown on the top line, while the
remainder, shown on the bottom line, is 10 2. In decimal, 27 divided by 5 is 5, with a remainder of 2.

Example # 2

1 0 0 1 1 Quotient

1 0 1 1 1 1 0 1 1 0 0 1 Dividend

1 0 1 1 Shifted divisor

0 1 0 1 Reduced dividend

0 0 0 0 Shifted divisor

1 0 1 0 Reduced dividend

0 0 0 0 Shifted divisor

1 0 1 0 0 Reduced dividend

64 | P a g e
1 0 1 1 Shifted divisor

1 0 0 1 1 Reduced dividend

1 0 1 1 Shifted divisor

1 0 0 0 remainder

1 1 Quotient 1 1 0 0

1 0 0 1 1 0 0 Dividend - 1 0 0 1st subtraction

1 0 0 1 0 0 0

1 0 0 - 1 0 0 2nd subtrahend

1 0 0 1 0 0

0 0 0 1 0 0 3rd subtrahend

0 0 0

Decimal: 12/4 = 3 Decimal 12/4 = 3

Therefore 11002 /1002 = 112

Exercises: Test your binary math skills with these practice problems and exercises.

1. 100 / 10 = Ans. 102


2. 111 / 11 = Ans. 102 r=1
3. 1010 / 100 = Ans. 102 r=10
4. 1101 / 11 = Ans. 1002 r=1
5. 10111 / 10 = Ans. 10112 r=1
6. 11111/101 = Ans. 1102 r=1
7. 111101/110 = Ans. 10102 r=1
8. 1001/10 = Ans. 1002 r=1

Binary Addition

Addition is a form of counting in which one quantity is added to another. The following definitions
identify
the basic terms of addition:
Augend is the quantity to which an addend is added
Addend a number to be added to a preceding number
Sum is the result of an addition (the sum of 5 and 7 is 12)
Carry is produced when the sum of two or more digits in a vertical column equals or exceeds the base
of the number system in use.

65 | P a g e
Let's start by adding two binary bits. Since each bit has only two possible values, 0 or 1, there
are only four possible combinations of inputs. These four possibilities, and the resulting sums, are:

0+0= 0
0+1= 1
1+0= 1
1+1= 0 plus a carry – over of 1

To add numbers, you can either count two digits in sequence or you can simply remember the
results of adding the four possible combinations of digits, as given in the addition table. Carry over are
performed in the same manner as in decimal arithmetic. Since 1 is the largest digit in the binary system,
sum greater than 1 requires that a digit be carried over.
Similarly, the addition of binary fractions is carried out in exactly the same manner as the addition
of binary integers, and when more than two binary numbers are added, the numbers accumulated to
a running total at a time. We do not used the same technique as with decimal numbers since that
would involve an exorbitant amount of carrying over.
Like decimal addition, when the sum in one column is a two-bit (two-digit) number, the least
significant figure is written as part of the total sum and the most significant figure is "carried" to the next
left column. Consider the following examples:

Examples # 1

Add 10112 and 11012. Solution: Write out the problem as shown:

As we noted previously, the sum of 1 and 1 is 2, which cannot be expressed as a single digit in the binary
system. Therefore, the sum of 1 and 1 produces a carry:

The following steps, with the carry indicated, show the completion of the addition’

In the final step the remaining carry is brought down to the sum. When the carry is added, it is marked
through to prevent adding it twice.

Examples # 2

Add 1112+12

66 | P a g e
The sum of the Augend and the first addend is 0 with a carry. The sum of the second and third
addends is also 0 with a carry. At this point the solution resembles the following example

The sum of the carries is 0 with a carry, so the sum of the problem is as follows

The same situation occurs in the following example: Add 100 2, 1012, and 1112

As in the previous example, the sum of the four 1s is 0 with two carries, and the sum of the two carries
is 0 with one carry. The final solution will look like this

In the addition of binary numbers, you should remember the binary addition rules:
Examples # 3

Base 2 Place 22 21 20

Carryover 1 1

1 1 3

+ 1 1 + 3

1 1 0 6

Base 2 Place 23 22 21 20

Carryover 1 1

1 0 1 1 11

+ 1 1 + 3

1 1 1 0 14

Base 2 Place 23 22 21 20

67 | P a g e
Carryover

1 0 0 0 8

+ 1 0 + 2

1 0 1 0 10

Base 2 Place 24 23 22 21 20

Carryover 1 1

1 1 0 1 13

+ 1 1 1 0 + 14

1 1 0 1 1 27

Base 2 Place 26 25 24 23 22 21 20

Carryover 1 1 1

1 1 0 1 0 1 53

+ 1 1 0 0 1 + 25

1 0 0 1 1 1 0 78

Exercises: Test your binary math skills with these practice problems and exercises.

1. 10011012+00100102 = Ans. 10111112


2. 10010012+00110012 = Ans. 11000102
3. 10001112+00101102 = Ans. 00101102
4. 101012+10102 = Ans. 111112
5. 100112 + 10102 = Ans. 111012
6. 111012 + 1002 = Ans. 1000012
7. 101102 + 110012 = Ans. 1011112
8. 1112 + 12 = Ans. 10002
9. 10100102 + 11101112 + 101012 = Ans. 110111102

Binary Subtractions

Subtraction is generally simpler than addition since only two numbers are involved and the
upper value representation is greater than the lower value representation. The problem of "borrow" is
similar in binary subtraction to that in decimal. We can construct a subtraction table that has two parts -
the three cases of subtracting without borrow, and the one case of the involvement of a borrow digit,
no matter how far to the left is the next available binary digit.

The following definitions identify the basic terms you will need to know to understand subtraction
operations:

Subtract To take away, as a part from the whole or one number from another
Minuend The number from which another number is to be subtracted ·
Subtrahend The quantity to be subtracted
68 | P a g e
Remainder, or Difference that which is left after subtraction
Borrow To transfer a digit (equal to the base number) from the next higher order column for the
purpose
of subtraction.

Rules:
0–0=0
1 -0=1
1–1=0
0 – 1 = 0 with a borrow of 1

Here are some examples of binary subtraction. These are computed without regard to the word
size, hence there can be no sense of "overflow" or "underflow". Work the columns right to left subtracting
in each column. If you must subtract a one from a zero, you need to “borrow” from the left, just as in
decimal subtraction.

1. 1011011 − 10010 = 1001001: 2. 1010110 − 101010 = 101100:


1 0 1 1 0 1 1 0 0
− 1 0 0 1 0 ×1 10 ×1 10 1 1 0
1 0 0 1 0 0 1 − 1 0 1 0 1 0
1 0 1 1 0 0

3. 100010110 − 1111010 = 4. 101101 − 100111 = 110: 5.1110110 − 1010111 = 11111:


10011100: 0 10 0 10 1 10 10
0 1 1 1 10 1 0 ×1 ×1 10 1 1 ×1 ×1 ×10 ×1 ×1 10
×1 ×10 ×10 ×10 ×1 10 1 1 0 − 1 0 0 1 1 1 − 1 0 1 0 1 1 1
− 1 1 1 1 010 1 1 0 1 1 1 1 1
1 0 0 1 1 100

5. 1000101 − 101100 = 11001:


0 1 1
×1 ×10 ×10 10 1 0 1
− 1 0 1 1 0 0
1 1 0 0 1

Another following example (10110 - 1100 2) demonstrates the four rules of binary subtraction:

69 | P a g e
Rule 4 presents a different situation because you cannot subtract 1 from 0. Since you cannot subtract 1
from 0 and have a positive difference, you must borrow the 1 from the next higher order column of the
minuend.

The borrow may be indicated as shown below

Now observe the following method of borrowing across more than one column in the example, 10002 -
12.

Exercises: Test your binary math skills with these practice problems and exercises.

1. 1102 - 102 = Ans. 1002


2. 1012 - 112 = Ans. 102
3. 10012 - 112 = Ans. 1102
4. 11012 - 112 = Ans. 10102
5. 100012 - 1002 = Ans. 11012
6. 110012 - 10012 = Ans. 100002
7. 101012 - 10102 = Ans. 10112
8. 111112 – 102 = Ans. 111012
9. 1112 – 1002 = Ans. 112
10. 100012 - 112 = Ans. 11102
11. 1000002 -12 Ans. 111112

b. Decimal number System

Decimal to Binary Conversion System


Rules: To convert decimal whole numbers from base 10 to any other base, divide the other numbers
repeated by the value of the base to which the number is being converted. The division
operation is repeated until the quotient is zero. The remainder written in reverses of the order in
which they were obtained from the new equivalent numerals.

The above rule is applied in the following example to convert the decimal numeral to binary
equivalent.

70 | P a g e
E.g. # 19810 =? 2 E.g. # 15410 =? 2

Division Quotients Remainder Division Quotients Remainder


198/2 99 0 154/2 77 0
99/2 49 1 77/2 38 1
49/2 24 1 38/2 19 0
24/2 12 0 19/2 9 1
12/2 6 0 9/2 4 1
6/2 3 0 4/2 2 0
3/2 1 1 2/2 1 0
½ 0 1 ½ 0 1
Therefore 19810 = 110001102 Therefore 15410 = 100110102

EXERCISES: For practice let’s convert these decimal numbers to binary:

1. 36310 = ?2 Ans. 36310 = 1011010112


2. 46210 = ?2 Ans. 46210 = 1110011102
3. 25310 = ?2 Ans. 25310 = 111111012
4. 58310 = ?2 Ans. 58310 = 10010001112
5. 16310 = ?2 Ans. 16310 = 101000112
6. 72910 = ?2 Ans. 72910 = 10110110012
7. 36810 = ?2 Ans. 36810 = 1011100002

Converting Decimal Numbers w/ Integral and Fractional Parts into its Binary Equivalent

Rules:

1st Step: Converting the Integral parts


2nd Step: Converting the Fractional Parts
3rd Step: The Binary equivalent of decimal numbers w/ Integral to fractional part is simply the
sum of their 2 equivalents.

E.g. # 1. Convert 25.625 to its Binary Equivalent

1st Step: Converting the Integral parts

Division Quotients Remainders


25/2 12 1
12/2 6 0
6/2 3 0
3/2 1 1
½ 0 1
Therefore: 2510 = 110012

2nd Step: Converting the Fractional Parts

Multiplication Integral Parts


0.625 X 2 = 1.25 1
0.25 X 2 = 0.5 0
0.5 X 2 = 1.0 1

Therefore: .62510 = .1012

71 | P a g e
3rd Step: The Binary equivalent of decimal numbers w/ Integral to fractional part is simply the sum of their
2
equivalents.
2510 + .62410 = 110012 +.1012
25.62510 = 11001.1012

E.g.# 2. Convert the Decimal number 24.625 to its binary equivalent.

1st Step: Converting the Integral parts

Division Quotients Remainder

24/2 12 0
12/2 6 0
6/2 3 0
3/2 1 1
½ 0 1
Therefore: 2410 = 110002
2nd Step: Converting the Fractional Parts

Multiplication Integral Parts


0.625 X 2 = 1.25 1
0.25 X 2 = 0.5 0
0.5 X 2 = 1.0 1
Therefore: .62510 = .1012
3rd Step: The Binary equivalent of decimal numbers w/ Integral to fractional part is
simply the
sum of their 2 equivalents.

2410 + .62410 = 110002 +.1012


25.62510 = 11000.1012

E.g. # 3. Convert 25.175 to its Binary equivalent

1st Step: Converting the Integral parts

Divisions Quotients Remainders


25/2 12 1
12/2 6 0
6/2 3 0
3/2 1 1
½ 0 1
Therefore: 2510 = 110012

2nd Step: Converting the Fractional Parts

Multiplication Integral Parts


0.175 x 2 = 0.35 0
0.35 x 2 = 0.7 0
0.7 x 2 = 1.4 1
0.4 x 2 = 0.8 0
0.8 x 2 = 1.6 1
0.6 x 2 = 1.2 1
72 | P a g e
0.2 x 2 = 0.4 0
0.4 x 2 = 0.8 0
0.8 x 2 = 1.6 1

Therefore: .17510 = .001011001….2

3rd Step: The Binary equivalent of decimal numbers w/ Integral to fractional part is
simply the
sum of their 2 equivalents.

2510 + .17510 = 110012 +.001011001…2


25.17510 = 11001.001011001…2

EXERCISES: For practice let’s convert these Decimal Numbers with Integral and Fractional Parts into its
Binary Equivalent:

1. 12.24310 = ?2
2. 18.23310 = ?2
3. 20.14310 = ?2
4. 18.22110 = ?2

c. Octal Numbering System


The Octal Number Base System

The octal, or base 8, number system is a common system used with computers. Because of its
relationship with the binary system, it is useful in programming some types of computers.
Look closely at the comparison of binary and octal number systems in table 1-3. You can see
that one octal digit is the equivalent value of three binary digits.
The following examples of the conversion of octal 225 8 to binary and back again further illustrate
this comparison:

Table 1-3. - Binary and Octal Comparison

73 | P a g e
Unit and Number

The terms that you learned in the decimal and binary sections are also used with the octal
system. The unit remains a single object, and the number is still a symbol used to represent one or more
units.

Base (Radix)

As with the other systems, the radix, or base, is the number of symbols used in the system. The
octal system uses eight symbols - 0 through 7. The base, or radix, is indicated by the subscript 8.

Positional Notation

The octal number system is a positional notation number system. Just as the decimal system uses
powers of 10 and the binary system uses powers of 2, the octal system uses power of 8 to determine the
value of a number's position. The following bar graph shows the positions and the power of the base:

Remember, that the power, or exponent, indicates the number of times the base is multiplied by itself.
The value of this multiplication is expressed in base 10 as shown below:

All numbers to the left of the radix point are whole numbers, and those to the right are fractional
numbers.

MSD and LSD

When determining the most and least significant digits in an octal number, use the same rules
that you used with the other number systems. The digit farthest to the left of the radix point is the MSD,
and the one farthest right of the radix point is the LSD.

Example:

If the number is a whole number, the MSD is the nonzero digit farthest to the left of the radix
point and the LSD is the digit immediately to the left of the radix point. Conversely, if the number is a

74 | P a g e
fraction only, the nonzero digit closest to the radix point is the MSD and the LSD is the nonzero digit
farthest to the right of the radix point.

Octal to Binary Conversion

The octal, or base 8, number system is a common system used with computers. Because of its
relationship with the binary system, it is useful in programming some types of computers.

Octal to Binary

2 2 58

010 010 1012

It is also easy to convert from an integer octal number to binary. This is accomplished by:

1. Convert the decimal number to its 3-bit binary equivalent.


2. Combine the 3-bit sections by removing the spaces.

For example, the octal value 127662 will be written:

1 2 7 6 6 2

001 010 111 110 110 010

For some computers to accept octal data, the octal digits must be converted to binary. This
process is the reverse of binary to octal conversion.
To convert a given octal number to binary, write out the octal number in the following format. We
will convert octal 5678:

Next, below each octal digit write the corresponding three-digit binary-coded octal equivalent:

Solution: 5678 equals 101 110 1112

Remove the conversion from the format 1011101112. As you gain experience, it may not be necessary to
use the block format. An octal fraction (.1238) is converted in the same manner, as shown below

Solution: .1238 equals .0010100112. Apply these principles to convert mixed numbers as well . Convert
32.258 to

75 | P a g e
binary

Solution: 32.258 equal 011010.0101012

To convert any integer octal number to its corresponding binary number we follow the following two
steps:
1. First convert the decimal number to its 3-bit binary equivalent.
2. And then combine the 3-bit sections by removing the spaces.

Let us take an example. If we have any octal number integer 31321(Q) to convert into its corresponding
binary number, we shall apply above two steps as follows:

Equivalent number 3 1 3 2 1
3-bit Section of Binary Number 011 001 011 010 001

Thus the binary equivalent for the octal number 31321(Q) is 011 0010 1101 0001.

Exercises: Test your binary math skills with these practice problems and exercises.

1. 738 Ans. 1110112


2. 5128 Ans. 1010010102
3. 4038 Ans. 1000000112
4. 0.4568 Ans. 0.1001011102
5. 0.738 Ans. 0.1110112
6. 36.58 Ans. 11110.1012

Binary to Octal Conversion

Binary to Octal

010 010 1012

2 2 58

To convert from an integer binary number to octal we follow the following two steps:

1. Break the binary number into 3-bit sections from the LSB to the MSB.
2. Convert the 3-bit binary number to its octal equivalent.

For example, the binary value 1010111110110010 will be written:

001 010 111 110 110 010

1 2 7 6 6 2

76 | P a g e
Let us take an example to better understand it. If we have given any binary number say
11001011010001 to convert into Octal Number System, we shall apply above two steps on this number
as follows:

3-bit Section of Binary Number 011 001 011 010 001


Equivalent number 3 1 3 2 1

Thus the Octal Number, Equivalent to The Binary Number 11001011010001 is 31321.

Look at the following numbers:

Since 8 is equal to 23, then one octal digit can represent three binary digits, as shown below

With the use of this principle, the conversion of a binary number is quite simple. As an example,
follow the conversion of the binary number at the beginning of this section. Write out the binary number
to be converted. Starting at the radix point and moving left, break the binary number into groups of
three as shown. This grouping of binary numbers into groups of three is called binary-coded octal (BCO).
Add 0s to the left of any MSD that will fill a group of three:

Next, write down the octal equivalent of each group

To convert a binary fraction to its octal equivalent, starting at the radix point and moving right, expand
each digit into a group of three

Add 0s to the right of the LSD if necessary to form a group of three. Now write the octal digit for each
group of three, as shown below

To convert a mixed binary number, starting at the radix point, form groups of three both right and left

77 | P a g e
Exercises: Test your binary math skills with these practice problems and exercises. Convert the
following binary numbers to octal.

1. 102 Ans. 28
2. 10102 Ans. 128
3. 1011112 Ans. 578
4. 0.00112 Ans. 0.148
5. 0.1100112 Ans. 0.638
6. 110111.0101012 Ans. 67.258

Octal to Decimal Conversion

Uses base 8 includes only the digits 0 through 7 (any other digit would make the number an invalid octal
number)

The weighted value for each position is as follows:

8^5 8^4 8^3 8^2 8^1 8^0

32768 4096 512 64 8 1

To convert from Octal to Decimal, multiply the value in each position by its octal weight and add each
value. Using the value from the previous example, 127662Q, we would expect to obtain the decimal
value 44978.

1*8^5 2*8^4 7*8^3 6*8^2 6*8^1 2*8^0

1*32768 2*4096 7*512 6*64 6*8 2*1

32768 8192 3584 384 48 2

32768 + 8192 + 3584 + 384 + 48 + 2 = 44978

Conversion of octal numbers to decimal is best done by the positional notation method. This
process is the one we used to convert binary numbers to decimal

First, determine the decimal equivalent for each position by multiplying 8 by it the number of
times indicated by the exponent. Set up a bar graph of the positions and values as shown below

78 | P a g e
To convert an octal number to decimal, write out the number to be converted, placing each digit
under the proper position

Example

Next, multiply the decimal equivalent by the corresponding digit of the octal number; then, add this
column of figures for the final solution

Solution: 7438 is equal to 48310

Now follow the conversion of 26525 8 to decimal

Solution: 11,60510 is the decimal equivalent of 26,5258. To convert a fraction or a mixed number, simply
use the same procedure

Example: Change .58 to decimal

Example: Convert 24.368 to decimal

Solution: 24.368 equals 20.4687510

If you prefer or find it easier, you may want to convert the octal number to binary and then to decimal.

79 | P a g e
Exercises: Test your binary math skills with these practice problems and exercises. Convert the
following numbers to decimal

1. 178 Ans. 1510


2. 648 Ans. 5210
3. 3758 Ans. 25310
4. 0.48 Ans. 0.510
5. 0.61 8 Ans. 0.76562510
6. 10.228 Ans. 8.2812510

Decimal to Octal Conversion

To convert decimal to octal is slightly more difficult. The typical method to convert from decimal
to octal is repeated division by 8. While we may also use repeated subtraction by the weighted position
value, it is more difficult for large decimal numbers.

Repeated Division by 8

For this method, divide the decimal number by 8, and write the remainder on the side as the
least significant digit. This process is continued by dividing the quotient by 8 and writing the remainder
until the quotient is 0. When performing the division, the remainders which will represent the octal
equivalent of the decimal number are written beginning at the least significant digit (right) and each
new digit is written to the next more significant digit (the left) of the previous digit. Consider the number
44978.

Division Quotient Remainder Octal Number

44978 / 8 5622 2 2

5622 / 8 702 6 62

702 / 8 87 6 662

87 / 8 10 7 7662

10 / 8 1 2 27662

1/8 0 1 127662

Additional:

First, determine the decimal equivalent for each position by multiplying 8 by itself the # of times
indicated by the exponent.

Ex.

64 16 1

7 4 38

Next, multiply the decimal equivalent by the corresponding digit of the octal number and then add this
column of figures for the final solution.

64 16 1

7 4 38

448 32 3 48310

80 | P a g e
The conversion of a decimal number to its base 8 equivalent is done by the repeated division method.
You simply divide the base 10 number by 8 and extract the remainders. The first remainder will be the
LSD, and the last remainder will be the MSD

Look at the following example. To convert 15 10 to octal, set up the problem for division

Since 8 goes into 15 one time with a 7 remainder, 7 then is the LSD. Next divide 8 into the
quotient (1). The result is a 0 quotient with a 1 remainder. The 1 is the MSD

Now write out the number from MSD to LSD as shown 178

The same process is used regardless of the size of the decimal number. Naturally, more divisions
are needed for larger numbers, as in the following example:

Convert 26410 to octal:

By rewriting the solution, you find that the octal equivalent of 264 10 is as follows: 4108

To convert a decimal fraction to octal, multiply the fraction by 8. Extract everything that appears to the
left of the radix point. The first number extracted will be the MSD and will follow the radix point. The last
number extracted will be the LSD.

Convert 0.0510 to octal:

81 | P a g e
Write the solution from MSD to LSD .03146 8

You can carry the conversion out to as many places as needed, but usually four or five places are
enough.

To convert a mixed decimal number to its octal equivalent, split the number into whole and fractional
portions and solve as shown below:

Convert 105.589 to octal


10

Combine the portions into a mixed number:

151.45548

Exercises: Test your binary math skills with these practice problems and exercises. Convert the
following decimal numbers to octal:

1. 1710 Ans.158
2. 6410 Ans.528
3. 37510 Ans.2538
4. 1. 710 Ans. 78
5. 2. 4310 Ans. 538
6. 3. 49910 Ans. 7638
7. 4. 0.95110 (four places). Ans. 0.74678
8. 5. 0.00410 (five places). Ans. 0.002038
9. 6. 252.1710 (three places) Ans. 374.1278

82 | P a g e
Addition of Octal Number System

The addition of octal numbers is not difficult provided you remember that anytime the sum of
two digits exceeds 7, a carry is produced. Compare the two examples shown below:

The octal addition table in table 1-4 will be of benefit to you until you are accustomed to adding
octal numbers. To use the table, simply follow the directions used in this example

Add: 68 and 58

Locate the 6 in the X column of the figure. Next locate the 5 in the Y column. The point in area Z
where these two columns intersect is the sum. Therefore

If you use the concepts of addition you have already learned, you are ready to add octal numbers
Work through the solutions to the following problems:

As was mentioned earlier in this section, each time the sum of a column of numbers exceeds 7,
a carry is produced. More than one carry may be produced if there are three or more numbers to be
added, as in this example

The sum of the augends and the first addend is 6 with a carry. The sum of 6 and the second
8 8

addend is 5 with a carry. You should write down the 5 and add the two carries and bring them down to
8 8

the sum, as shown below.

Exercises: Test your binary math skills with these practice problems and exercises.

1. 38 + 58 Ans. 108
2. 228 + 368 Ans. 608
3. 6218 +1748 Ans. 10158
4. 132558 + 70318 Ans. 223068
5. 248 +428 +638 Ans. 1518
6. 38 + 58 +28 + 68 + 48 Ans. 248
83 | P a g e
Subtractions of Octal Number System

The subtraction of octal numbers follows the same rules as the subtraction of numbers in any
other number system. The only variation is in the quantity of the borrow. In the decimal system, you had
to borrow a group of 1010. In the binary system, you borrowed a group of 210. In the octal system you will
borrow a group of 810

Consider the subtraction of 1 from 10 in decimal, binary, and octal number systems

In each example, you cannot subtract 1 from 0 and have a positive difference. You must use a
borrow from the next column of numbers. Let’s examine the above problems and show the borrow as a
decimal quantity for clarity

When you use the borrow, the column you borrow from is reduced by 1, and the amount of the
borrow is added to the column of the minuend being subtracted. The following examples show this
procedure.

In the octal example 78 cannot be subtracted from 68, so you must borrow from the 4. Reduce
the 4 by 1 and add 108 (the borrow) to the 68 in the minuend. By subtracting 78 from 168, you get a
difference of 78. Write this number in the difference line and bring down the 3. You may need to refer to
table 1-4, the octal addition table, until you are familiar with octal numbers. To use the table for
subtraction, follow these directions. Locate the subtrahend in column Y. Now find where this line
intersects with the minuend in area Z. The remainder, or difference, will be in row X directly above this
point

Exercises: Test your binary math skills with these practice problems and exercises. Do the following
problems to practice your octal subtraction.

1. 7658 – 4448 Ans. 3218


2. 448 – 68 Ans. 368
3. 5328 - 1748 Ans. 3368
4. 10238 – 4248 Ans. 3778
5. 4238 – 3268 Ans. 1048
6. 7776 – 7 Ans. 77678

Check your answers by adding the subtrahend and difference for each problem.

84 | P a g e
d. Hexadecimal Numbering System

Octal to Hexadecimal
You will probably not run into many occasions that call for the conversion of octal numbers to
hex. Should the need arise, conversion is a two-step procedure. Convert the octal number to binary;
then convert the binary number to hex. The steps to convert 53.7 8 to hex are shown below

Regroup the binary digits into groups of four and add zeros where needed to complete groups; then
convert the binary to hex

Solution: 53.78 equal 2B.E16

Exercises: Test your binary math skills with these practice problems and exercises. Convert the following
numbers to hex.

1. 748 Ans. 3C16


2. 5128 Ans. 14A16
3. 0.038 Ans. 0.0C16
4. 14.428 Ans. C.8816

The Hexadecimal Number Base System


The hex number system is a more complex system in use with computers. The name is derived
from the fact the system uses 16 symbols. It is beneficial in computer programming because of its
relationship to the binary system. Since 16 in the decimal system is the fourth power of 2 (or 2 ); one hex
4

digit has a value equal to four binary digits. Table 1-5 shows the relationship between the two systems.

Table 1-5. —Binary and Hexadecimal Comparison

Unit and Number

As in each of the previous number systems, a unit stands for a


single object.

A number in the hex system is the symbol used to


represent a unit or quantity. The Arabic numerals 0
through 9 are used along with the first six letters of the
alphabet. You have probably used letters in math
problems to represent unknown quantities, but in the
hex system A, B, C, D, E, and F, each have a definite
value as shown below.

85 | P a g e
Base (Radix)

The base, or radix, of this system is 16, which represents the number of symbols used in the
system. A quantity expressed in hex will be annotated by the subscript 16, as shown below

A3EF16

Positional Notation

Like the binary, octal, and decimal systems, the hex system is a positional notation system.
Powers of 16 are used for the positional values of a number. The following bar graph shows the positions

163 162 161 160 -1 16-2 16-3

Multiplying the base times itself the number of times indicated by the exponent will show the
equivalent decimal value

Hexadecimal to Binary Conversion

To convert a hex number to binary, set up the number in the block format you used in earlier
conversions. Below each hex digit, write the four-digit binary equivalent. Observe the following example

Convert ABC16 to binary

Solution: ABC16 = 1010101111002

Converting from Binary to hexadecimal and hex to binary is very easy if you have a table of
numbers or if you know the numbers well. Let’s do an example starting with hex to binary. Let’s say
you’ve got the hex # 3CF. To covert binary, all you have to do is write down 3 in binary;

3 = 0011
C = 1100
F = 1111
= 0011 1100 1111 (the zero/s at the left side is unnecessary, you can it)

Exercises: Test your binary math skills with these practice problems and exercises.

1. 4C316 =
2. 75A116 =
3. AB316 =
4. F2316 =
5. 83716 =

86 | P a g e
Binary to Hexadecimal Conversion

The table below shows the relationship between binary and hex numbers. You can see that four
binary digits may be represented by one hex digit. This is because 16 is equal to 2 4

Binary Hex
Value Value FOR A 16 POSITION DIGITAL OUT USE FOUR CONSECUTIVE HEX VALUES TO DEFINE
0000 0 THE STATUS.
0001 1 EXAMPLE: FC2D = 1111 1100 0010 1101
0010 2 IN THIS EXAMPLE (COUNTING FROM THE RIGHT) RELAYS 2,5,7,8,9,10 WOULD
0011 3 ENGAGE
0100 4
0101 5
0110 6
0111 7
Using this relationship, you can easily convert binary numbers to hex.
1000 8
Starting at the radix point and moving either right or left, break the number into
1001 9
groups of four. The grouping of binary into four bit groups is called binary-
1010 A
coded hexadecimal (BCH).
1011 B
1100 C Convert 1110100112 to hex:
1101 D
1110 E
1111 F

Add 0s to the left of the MSD of the whole portion of the number and to the right of the LSD of the
fractional part to form a group of four

Convert .1112 to hex

In this case, if a 0 had not been added, the conversion would have been .7 16, which is incorrect.

Additional:

Example: 1101011010, to convert this to hex, you have to divide it up into groups of 4 starting from
the right hand side, 0011 0101 1010, to make a group of four, you can add zero/s to the
front. And you just write down whatever the hex is.

The hex for 0011 is 3, 0101\ is 5, 1010 is A. So 35A in hex is equals 11 0101 1010.

Exercises: Test your binary math skills with these practice problems and exercises. Convert the
following binary numbers to hex:

1. 102 Ans. 216


2. 10112 Ans. B16
3. 1011112 Ans. 2F16
4. 0.00112 Ans. 0.316
5. 0.1100112. Ans. 0.CC16
6. 110111.0101012 Ans. 37.5416

87 | P a g e
Hexadecimal to Decimal Conversion

Steps:

1. Get the last digit of the hex number; call this digit the current Digit.
2. Make a variable, let's call it power. Set the value to 0.
3. Multiply the current digit with (16^power), store the result.
4. Increment power by 1.
5. Set the current Digit to the previous digit of the hex number.
6. Repeat from step 3 until all digits have been multiplied.
7. Sum the result of step 3 to get the answer number.

Example 1
Convert the number 1128 HEXADECIMAL to DECIMAL

MULTIPLICATION RESULT NOTES


8 x (16^0) 8 Start from the last digit of the number. In this case, the number is
1128. The last digit of that number is 8. Note that the power of 0 of any
number is always 1
2 x (16^1) 32 Process the previous, which is 2. Multiply that number with an
increasing power of 16.
1 x (16^2) 256 Process the previous digit, which is 1, note that 16^2 means 16 x 16
1 x (16^3) 4096 Process the previous digit, which is 1, note that 16^3 means 16 x 16 x 16
Here, we stop because there's no more digit to process
ANSWER 4392 This number comes from the sum of the RESULTS
(8+32+256+4096)=4392

Once discerned, notice that the above process is essentially performing this calculation:

1x(16^3) + 1x(16^2) + 2x(16^1) + 8x(16^0)

When doing this by hand, it is easier to start backward is because:

• Counting the number of digits takes extra time, and you might count wrongly.
• If you don't remember what a particular value of a power-of-16 is, it's easier to calculate it from
the previous power value. For instance, if you don't remember what the value of 16^3 is, then
just multiply the value of 16^2 (which you'll likely already have if you started backward) with 16.
Example 2
Convert the number 589 HEXADECIMAL to DECIMAL MULTIPLICATION RESULT
9 x (16^0) 9
8 x (16^1) 128
5 x (16^2) 1280

ANSWER 1417

If you want to be a speed counter, it's beneficial to memorize the values of the smaller power of 16s,
such as in this table

POWER OF 16s RESULT


16^0 1
16^1 = 16 16
16^2 = 16x16 256
16^3 = 16x16x16 4096
16^4 = 16x16x16x16 65536

88 | P a g e
Example 3
Convert the number 1531 HEXADECIMAL to DECIMAL
(This time, let's use the table of the power-of-16s above.)

MULTIPLICATION RESULT
1x1 1
3 x 16 48
5 x 256 1280
1 x 4096 4096
ANSWER 5425

Example 4
Convert the number FA8 HEXADECIMAL to HEXADECIMAL

MULTIPLICATION RESULT
8x1 8
A x 16 (remember that hex A=decimal 10) 160
F x 256 (remember that hex F=decimal 15) 3840
ANSWER 4008

Example 5
Convert the number 8F HEXADECIMAL to DECIMAL

DIVISION RESULT
Fx1 15
8 x 16 128
ANSWER 143

Example 6
Convert the number A0 HEXADECIMAL to DECIMAL

DIVISION RESULT
0x1 0
A x 16 160
ANSWER 160

Example 7
Convert the number 12 HEXADECIMAL to DECIMAL

DIVISION RESULT
2x1 2
1 x 16 16
ANSWER 18

2x(16^0) + 3x(16^1) + 4x(16^2) + 5x(16^3) + 3x(16^4) =


2 + 3x16 + 4*256 + 5*4096 + 3*65536 =
2 + 48 + 1024 + 20480 + 196608 =
218162

It is difficult to comprehend the magnitude of a base 16 number until it is presented in base 10;
for instance, E016 is equal to 22410. You must remember that usually fewer digits are necessary to
represent a decimal value in base 16

89 | P a g e
When you convert from base 16 to decimal, you may use the positional notation system for the
powers of 16 (a bar graph). You can also convert the base 16 number to binary and then convert to
base 10

Note in the bar graph below that each power of 16 results in a tremendous increase in the
decimal equivalent. Only one negative power (16 ) is shown for demonstration purposes:
1

Just as you did with octal conversion, write out the hex number, placing each digit under the
appropriate decimal value for that position. Multiply the decimal value by the base 16 digit and add
the values. (Convert A through F to their decimal equivalent before multiplying). Let’s take a look at an
example

Convert 2C16 to decimal

The decimal equivalent of 2C16 is 4410. Use the same procedure we used with binary and octal to
convert base 16 fractions to decimal. If you choose to convert the hex number to binary and then to
decimal, the solution will look like this

Additional:

Let’s say we have the hex number 4C3 that we want to change to decimal. We do the powers
of 16, one, then 16, then 16 times 16 is 256. Now we go through and we have 4 times 256. We have C
times 16. Remember A=10, B=11, C=12, D=14, E=15, F=16

256 16 1
4 C 3
=4(16) = 1024
=C12(16) = 192
=3(1) = 3 then we add those up and get the final answer, =121910 and 4C316 in
decimal.

Exercises: Test your binary math skills with these practice problems and exercises. Convert these base
16 numbers to base 10.

1. 2416 Ans. 3610


2. A516 Ans. 16510
3. DB16 Ans. 21910
4. 3E6.516 Ans. 998.312510

90 | P a g e
Decimal to Hexadecimal Conversion

To convert a decimal number to base 16, follow the repeated division procedures you used to
convert to binary and octal, only divide by 16. Let’s look at an example:

Convert 6310 to hex:

Therefore, the hex equivalent of 6310 is 3F16.

You have to remember that the remainder is in base 10 and must be converted to hex if it exceeds 9.
Let’s work through another example:

Convert 17410 to hex

Write the solution from MSD to LSD

AE16

There will probably be very few times when you will have to convert a decimal fraction to a hex
fraction. If the occasion should arise, the conversion is done in the same manner as binary or octal. Use
the following example as a pattern:

Convert 0.69510 to hex

The solution: .B1EB16

Should you have the need to convert a decimal mixed number to hex, convert the whole number and
the fraction separately; then recombine for the solution. Additional: convert from decimal to
hexadecimal. We have the number 100010 and we want to convert this to hex. The same way to convert
decimal to binary. We take 1000 and divide it by 16.

1 0 0 0 10 16
r.8 6 2 10 16
r.14 3 10 16
r.3 0
3E816

Exercises: Test your binary math skills with these practice problems and exercises. Convert the following
decimal numbers to hex

1. 4210 Ans. 2A16


2. 8310 Ans. 5316
3. 17610 Ans. B016
4. 49110 Ans. 1EB16
5. 0.72110 (four places) Ans. 0.B89316

91 | P a g e
Hexadecimal to Octal

Just like the conversion of octal to hex, conversion of hex to octal is a two-step procedure. First,
convert the hex number to binary; and second, convert the binary number to octal. Let’s use the same
example we used above in the hex to binary conversion and convert it to octal

Exercises: Test your binary math skills with these practice problems and exercises. Convert these base
16 numbers to their equivalent base 2 and base 8 numbers.

1. 2316 Ans. 1000112; 438


2. 1B16 Ans. 110112; 338
3. 0.E416 Ans. 0.1110012; 0.718
4. 45.A16 Ans. 1000101.1012; 105.58

Addition of Hexadecimal

The addition of hex numbers may seem intimidating at first glance, but it is no different than
addition in any other number system. The same rules apply. Certain combinations of symbols produce a
carry while others do not. Some numerals combine to produce a sum represented by a letter. After a
little practice you will be as confident adding hex numbers as you are adding decimal numbers.

Study the hex addition table in table 1-6. Using the table, add 7 and 7. Locate the number 7 in
both columns X and Y. The point in area Z where these two columns intersect is the sum; in this case 7 +
7 = E. As long as the sum of two numbers is 1510 or less, only one symbol is used for the sum. A carry will
be produced when the sum of two numbers is 16 10 or greater, as in the following examples:

Table 1-6 —Hexadecimal Addition Table

92 | P a g e
Use the addition table and follow the solution of the following problems

In this example each column is straight addition with no carry

Now add the addend (78416) and the sum (BDA16) of the previous problem

Here the sum of 4 and A is E. Adding 8 and D is 15 16; write down 5 and carry a 1. Add the first
carry to the 7 in the next column and add the sum, 8, to B. The result is 13 16; write down 3 and carry a 1.
Since only the last carry is left to add, bring it down to complete the problem

Now observe the procedures for a more complex addition problem. You may find it easier to add the
Arabic numerals in each column first

The sum of 4, E, 1, and 3 in the first column is 16 16. Write down the 6 and the carry. In the second
column, 1, 1, 9, and 7 equals 1216. Write the carry over the next column. Add B and 2 the sum is D. write
this in the sum line. Now add the final column, 1, 1, 5, and C. The sum is 13 16. Write down the carry; then
add 3 and B the sum is E. Write down the E and bring down the final carry to complete the problem

Exercises: Test your binary math skills with these practice problems and exercises. Now solve the
following addition problems.

1. 4A3C16 + 935116 Ans. DD8D16


2. 432116 + DCBA16 Ans. 11FDB16
3. 27416 + FEB16 Ans. 125F16
4. 79DF16 + A64116 Ans. 1202016
5. ECFD16 + A4AE16 Ans. 191AB16
6. BC16 + A2316 + FC916 Ans. 1AA816

Subtraction of Hexadecimal
The subtraction of hex numbers looks more difficult than it really is. In the preceding sections you
learned all the rules for subtraction. Now you need only to apply those rules to a new number system.
The symbols may be different and the amount of the borrow is different, but the rules remain the same

Use the hex addition table (table 1-6) to follow the solution of the following problems

93 | P a g e
Working from left to right, first locate the subtrahend (2) in column Y. Follow this line across area Z
until you reach C. The difference is located in column X directly above the C in this case A. Use this
same procedure to reach the solution

Now examine the following solutions

In the previous example, when F was subtracted from 1E, a borrow was used. Since you cannot
subtract F from E and have a positive difference, a borrow of 10 16 was taken from the next higher value
column. The borrow was added to E, and the higher value column was reduced by 1.

The following example shows the use of the borrow in a more difficult problem:

In this first step, B cannot be subtracted from 7, so you take a borrow of 10 16 from the next higher
value column. Add the borrow to the 7 in the minuend; then subtract (1716 minus B16 equals C16).
Reduce the number from which the borrow was taken (3) by 1.

To subtract 416 from 216 also requires a borrow, as shown below

Borrow 1016 from the A and reduce the minuend by 1. Add the borrow to the 2 and subtract 4 16
from 1216. The difference is E. When solved the problem looks like this

Remember that the borrow is 1016 not 1010

There may be times when you need to borrow from a column that has a 0 in the minuend. In
that case, you borrow from the next highest value column, which will provide you with a value in the 0
column that you can borrow from

94 | P a g e
To subtract A from 7, you must borrow. To borrow you must first borrow from the 2. The 0
becomes 1016, which can give up a borrow. Reduce the 10 16 by 1 to provide a borrow for the 7.
Reducing 1016 by 1 equals F. Subtracting A16 from 1716 gives you D16. Bring down the 1 and F for a
difference of 1FD16

Exercises: Test your binary math skills with these practice problems and exercises. Now let’s practice
what we’ve learned by solving the following hex subtraction problems

1. 75816 – 42316 Ans. 33516


2. D9F16 – 46A16 Ans. 93516
3. A1C616 – C9516 Ans. 953116
4. 405716 – 9A416 Ans. 36B316
5. 1357916 – 2ABD16 Ans. 10ABC16
6. EFACD16 – ACBBE16 Ans. 42F0F16

C. Coding Systems for Text-Based Data

Text-based data is represented by fixed-length binary coding systems specifically developed for
text-based data- namely, ASCII, EBCDIC, and UNICODE. Such codes represent all characters on the
keyboard that can appear in text data – numeric character, alphabetic characters, and special
characters, such as the dollar sign ($) and period (.).

a. ASCII and EBCDIC. American Standard Code for Information Technology is the coding system
traditionally used with PCs. ASCII is a 7-digit code, although there are several different 8-bit
extended versions of ASCII that include extra characters to represent non-English characters,
graphics symbols, and mathematical symbols. Extended Binary-coded Decimal Interchange
Code was developed by IBM, primarily for use with mainframes. The extended ASCII character
sets and EBCDIC both represent each character as a unique combination. Therefore, an 8-bit
code can represent up to 256 characters, including the 26 uppercase and 26 lowercase
characters used in the English alphabet. Many computer systems can work with both ASCII and
EBCDIC. Limited only the Latin alphabet use with the English language.

Character ASCII EBCDIC


0 00110000 11110000
1 00110001 11110001
2 00110010 11110010
3 00110011 11110011
4 00110100 11110100
5 00110101 11110101
A 01000001 11000001
B 01000010 11000010
C 01000011 11000011
D 01000100 11000100
E 01000101 11000101
F 01000110 11000110
+ 00101011 01001110
! 00100001 01011010
# 00100011 01111011

95 | P a g e
b. Unicode, an international coding system for text-based data using
any written in any ancient or modern language, including those
with different alphabets, such as Chinese, Greek, Hebrew, Amharic,
Tibetan, and Russian.

C. Coding Systems for Other Types of Data

a. Graphics Data, consists of still images, such as photographs or drawing. One of the most
common methods for storing graphics data is in the form of a bitmap – a grid of hundreds of
thousands of dots called pixels, arranges to represent an image. The color of each pixel is
represented by bits; the more bits used, the better the image quality.
b. Audio Data, such as song or sound of someone speaking – must be in digital form in order to be
stored on a storage medium or processed by a PC.
c. Video Data, such as movies, feature films, and television shows – is displayed using a collection of
frames; each frame contains a still graphical image.

Machine language, a binary-based language for representing computer programs that the computer
can execute directly.

96 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy