0% found this document useful (0 votes)
3 views

Module 1

Module 1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Module 1

Module 1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Module 1 1

Number Systems and Digital Arithmetic

Number Systems and Arithmetic Operations

Intended Learning Outcomes


1. Understand the concept of Number Systems
2. Able to perform conversion between different number systems
3. Perform an arithmetic operation on different number systems

Part 1: Number Systems


What is a Number System?

You probably know what number is, from the beginning counting numbers is one of the first
lessons whether from our parents or from a teacher. As a kid we learn to count form 1 to 10 then
advanced it to hundreds, thousands and so on. We are also taught to read large digits number and
by now it is safe to assume that everyone can already read a large digits of numbers. However, do
we really understand the basics of the number systems we normally use?

Decimal Systems

The number system that we learn from the beginning is a Decimal System. It is a base 10 system
which means we have nine numbers to count (0, 1, 2…9). As we can see, counting using decimal
systems always starts with zero and ends with 9. Whenever we reach the end of the count we
immediately return to zero and start another count. Thus in decimal system the number after 9 is 10
in which we return to zero and put another number on its left which tells us that we are on N count
already which in this case gives a number 10.

1 0

We are on the second Starting number of the


set of counting second set of counting

What are the other number systems?


Aside from decimal systems, we have other numbers systems, these systems are
mainly used by our computer in its operations. The following are the numbers systems and
how to count using these systems.
Octal System
This is a base 8 system, meaning it only has 8 digits to count starting from
zero to 7. As opposed to decimal systems, octal system has no numbers 8 and
9. This number system is already obsolete.
Module 1 2
Number Systems and Digital Arithmetic

Hexadecimal System
This is a base 16 system, meaning it has 16 digits to count. There is a slight
difference in the counting of hexadecimal systems. It uses a Arabic numerals
on its first 10 counts and uses an Alphabet starting from A on its succeeding
counts. Thus, the digits of hexadecimal numbers are from 0, 1, 2...9 the
followed by A,B, C…F. Succeeding counts will be 10 to 1F and so on.

Binary Systems
The binary system (base 2) is the simplest number system since it only has 2
numbers to count. This systems is use to represent the states of the machines
(High or Low, Positive or Negative). The digit in this system is 0 and 1 only.

Part 2: Conversion
To easily identify which number system the number belong we will be required to put a
subscript on every number we are going to write. The subscript will be the base of the
number system in which the number belongs.
2.1 Decimal System to another System
Let’s have a following example:
Example 2.1
2510 to Octal
1. Take the number and divide it with the base or the target number system, then
take its remainder.

25 / 8 remainder 1
2. Next, divide the quotient of the first operation again with the base of the
target number system and take again take its remainder. Do this until the
quotient is equal to zero

25 / 8 = 3 remainder 1
3 /8 = 0 remainder 3

3. If the quotient is equal to zero, read the digits of the remainder from bottom to
top and that will be the octal value of the given decimal number.

25 / 8 = 3 remainder 1
3 /8 = 0 remainder 3 318
Module 1 3
Number Systems and Digital Arithmetic

Another example:
Example 2.2
25010 Octal

250 / 8 = 31 remainder 2
31 / 8 = 3 remainder 7 3728

3 / 8 = 0 remainder 3

25010 3728

The same step is applicable when converting decimal to other number system
Example 2.3
2510 to Hexadecimal
In this case the base of the target number system is 16. Thus, the decimal
number will divide by 16 instead of 8.
25 / 16 = 1 remainder 9
1916
1 / 16 = 0 remainder 1
2510 is equal to 1916
Example 2.4
25010 Hex

250 / 16 = 15 remainder 10 (note: 10 in Hex is A) - A


FA16
15 / 16 = 0 remainder 15 (note: 15 in Hex is F) - F

25010 FA16
Example 2.5
2510 to Binary
25 / 2 = 12 remainder 1
12 / 2 = 6 remainder 0
6 / 2 = 3 remainder 0
110012
3 / 2 = 1 remainder 1
Module 1 4
Number Systems and Digital Arithmetic

1/ 2 = 0 remainder 1
2510 is equal to 110012
Example 2.6
25010 Bin

250 / 2 = 125 remainder 0


125 / 2 = 62 remainder 1
62 / 2 = 31 remainder 0
31 / 2 = 15 remainder 1
1111 10102
15/ 2 = 7 remainder 1
7/ 2 = 3 remainder 1
3/ 2 = 1 remainder 1
1/ 2 = 0 remainder 1

25010 is equal to 1111 10102

2.2 Any number system to Decimal System


Example 2.7
3728 to Decimal
1. Take the number and arrange it from and multiply it with its own base
raised to a number starting from zero to n as presented in the equation
below
Last digit x base n
number x base n++

2 x 80 = 2
7x 81 = 56
3x 82 = 192

2. Add the result. The sum will be the decimal equivalent of the given
number
192 + 56 + 2 = 250

3728 25010
Module 1 5
Number Systems and Digital Arithmetic

Example 2.8
FA16 Decimal
Following the step on example 1
A or 10 x 160 = 10
F or 15 x 161 = 240
Sum: 240 + 10 = 250
FA16 25010
Example 2.9
1111 10102 Decimal

0 x 20 = 0
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
1 x 24 = 16
1 x 25 = 32
1 x 26 = 64
1 x 27 = 128
Sum: 128+64+32+16+8+2 = 250
1111 101016 25010

2.3 Any Number Non-Decimal to other Non-Decimal System


Example 2.10
3728 to Binary
Every digit of the octal number is equivalent to 3 bit binary number. To convert the
octal number to binary, take the digit of the octal number and convert it separately to
its binary equivalent.
3 7 2

011 111 010


3728 011 111 0102
Module 1 6
Number Systems and Digital Arithmetic

Example 2.11
FA16 to Binary
Every digit of the Hexadecimal number is equivalent to 4 bit binary number. To
convert the Hex number to binary, take the digit of the Hex number and convert it
separately to its binary equivalent.
F A

1111 1010

FA16 1111 10102


Exercise 2.1
Perform the following conversion
a. 1110110010011102
a.1. Hexadecimal a.2. Octal

b. 234510
b.1. Binary b.2. Hexadecimal
Module 1 7
Number Systems and Digital Arithmetic

Part 3: Arithmetic Operations


Performing an arithmetic operation on different number systems is no different from
Decimal system.
Example 3.1
Addition in Decimal System
1+1=2
2+2=4
4 + 5 = 10
5 + 5 = 0 carry 1 = 10
Naturally, we may say that 5 + 5 is equal to 10 because it is what we are taught from the beginning. But
if we examine the decimal system, the biggest number in its count is 9. However, the operation 5 + 5
leads to a number higher than 9, thus, we need to start another count and put a value to show that we
are already on our second count. This idea is also applicable on the operations of other number
systems.
Example 3.1.1
234 235 1899
+ 345 +200 + 534
579 435 2433

Addition in Octal System


1+1=2
2+2=4
4 + 4 = 0 carry 1 = 10
5 + 5 = 2 carry 1 = 12
In the octal example 4 + 4 is equal to 0 carry 1 or 10 because the largest number in the octal count is 7
and 4 + 4 leads to 1- count higher than 7 which is our count will give a value of 10. The operation 5 + 5
leads to a value 3-points higher than 7 thus, giving a resulting value of 12.
Example 3.1.2
234 235 1755
+ 345 +200 + 534
601 435 2511
Module 1 8
Number Systems and Digital Arithmetic

Addition in Hexadecimal System


1+1=2
2+2=4
4+4=8
5+5=A
7+7=E
8 + 8 = 0 carry 1 = 10
Example 3.1.2
285 235 1A5A
+ 385 +2BA + 5F4
60A 4EF 204E

Addition in Binary System


1+0=1
0+1=1
1 + 1 = 0 carry 1 = 10
1 + 1 + 1 = 1 carry 1 = 1 1
Example 3.1.3
1110111 1111100 1100001
+ 1011110 + 000011 + 000110
11010101 1111111 1100111

Signed Binary Operations


In arithmetic operations, it is important to consider the sign (positive or
negative) of the numbers to be calculated. In elementary mathematics, the operation
of the signed numbers may lead to a slightly different result. The signed binary
operations can performed using 1’s complement or 2’s complement.
1’s Complement
The idea of the 1’s complement is to invert the digits of the binary number with
a negative sign. Let’s take the following example;
Module 1 9
Number Systems and Digital Arithmetic

Example 3.2
Perform the following operation using 4-digit binary operation.

5 0101 010 1 1. The Most significant bit (MSB) is use to show the sign of the
-3 1 011 1 100 number.
1 001 1 2. Only the numbers with negative sign are to be complemented
1 3. After all the negatively signed numbers are complemented
0100 perform an addition operation to the numbers.
4. If there is an extra number beyond 4-digit, add this number to
the result.

Example 3.2.1
Perform the following operation using 4-digit binary operation.
-5 1 1 01 1 010 1 010 The first 1’s complement is for the
-- 3 1 01 1 1 100 001 1 first negative and the second
1 10 1 complement is for the second
Since the result is a 1 010 negative.
negatively number we
need to perform another Note: The second complement
complement on the includes all the number including
result. the sign ( - (-3)).

Exercises 3.2.1
Perform the following operation using a 8-bit binary operation
1. -35 – 48

2. – 54 – (- 39)
Module 1 10
Number Systems and Digital Arithmetic

2’s Complement
The idea of the 2’s complement is to invert the digits of the binary number with
a negative sign and then add 1 on the Least Significant Bit (LSB) of the answer. Let’s
take the following example;
Example 3.2.2
Perform the following operation using 4-digit binary operation and 2’s
complement.

5 0101 010 1 0101 1100


-3 1 011 1 100 1 101 + 1
10010 1101
The excess 1 will
be disregarded

Example 3.2.3
Perform the following operation using 4-digit binary operation.
-5 1 1 01 1 010 1 0 1 1 1100 0010
-- 3 1 01 1 1 10 1 0 01 1 + 1 + 1
1 1 10 110 1 0 011
Since the result is a 1 001
negatively number we +1
need to perform another 1 010
2 ‘s complement on the
result.

Exercises 3.2.1
Perform the following operation using a 8-bit binary operation
1. -35 – 48

2. – 54 – (- 39)
Module 1 11
Number Systems and Digital Arithmetic

Binary Coded Decimal (BCD)


Binary Coded decimal is the 4-bit binary representation of each digit of decimal
number. Let’s say we have a decimal number 234, the BCD equivalent of this
decimal number is 0010 0011 0100. Don’t be confused the BCD numbers into
hexadecimal number. Binary coded decimal represents number from 0 to 9 as
compare to hexadecimal number which utilizes all 4-bit values.
Addition of BCD numbers 1. Convert each digit of Decimal number into 4-
bit binary equivalent
Example 3.3.1
2. Perform the needed operation
2504 -0010 0101 0000 0100
3. If in the case that the binary sum of the digits
+345 - 001 1 01 00 0101
exceed the max number of decimal (9) or has
28 4 9 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 1
generate a carry to the next digit, a correction of
0110 is added to that particular digit.

Example 3.3.2
A correction is added in the first and third digit of
2507 -0010 0101 0000 01 11 the BCD since it exceeded the maximum value
+545 - 0101 01 00 0101 that a single digit of decimal system can
30 5 2 0 0 1 0 1 0 1 0 0 1 0 0 1 1 00 represent
0110 0110
0 0 1 1 0 00 0 0101 0010

Exercise 3.3.1
Perform the following operation using Binary Coded Decimal:
a. 2345 + 869

b. 63525 + 3562

You might also like