Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Number Systems

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

NUMBER SYSTEMS

Number Systems
The language we use to communicate with each other is comprised of words and
characters. We understand numbers, characters and words. But this type of data is not
suitable for computers. Computers only understand the numbers.

So, when we enter data, the data is converted into electronic pulse. Each pulse is
identified as code and the code is converted into numeric format by ASCII. It gives each
number, character and symbol a numeric value (number) that a computer understands.
So to understand the language of computers, one must be familiar with the number
systems.

The Number Systems used in computers are:

o Binary number system


o Octal number system
o Decimal number system
o Hexadecimal number system

Binary number system


It has only two digits '0' and '1' so its base is 2. Accordingly, In this number system,
there are only two types of electronic pulses; absence of electronic pulse which
represents '0'and presence of electronic pulse which represents '1'. Each digit is called a
bit. A group of four bits (1101) is called a nibble and group of eight bits (11001010) is
called a byte. The position of each digit in a binary number represents a specific power
of the base (2) of the number system.

Octal number system


It has eight digits (0, 1, 2, 3, 4, 5, 6, 7) so its base is 8. Each digit in an octal number
represents a specific power of its base (8). As there are only eight digits, three bits
(23=8) of binary number system can convert any octal number into binary number.
1
This number system is also used to shorten long binary numbers. The three binary
digits can be represented with a single octal digit.

Decimal number system


This number system has ten digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) so its base is 10. In this
number system, the maximum value of a digit is 9 and the minimum value of a digit is
0. The position of each digit in decimal number represents a specific power of the base
(10) of the number system. This number system is widely used in our day to day life. It
can represent any numeric value.

Hexadecimal number system


This number system has 16 digits that ranges from 0 to 9 and A to F. So, its base is 16.
The A to F alphabets represent 10 to 15 decimal numbers. The position of each digit in
a hexadecimal number represents a specific power of base (16) of the number system.
As there are only sixteen digits, four bits (24=16) of binary number system can convert
any hexadecimal number into binary number. It is also known as alphanumeric number
system as it uses both numeric digits and alphabets.

Decimal Number system ( Base 10)


Decimal number system has 10 digits i.e 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Each digit has a
positioned value predetermined by how many places to the left or right of decimal point
the digit is written. Digit and positional value for each number system depends on the
base (also called radix) of the number system. Decimal number system has a base of 10
e.g. 12310, 78510. Successive positions to the left of the decimal point represent units
(ones, tens, hundreds, etc), each position represents a specific power of base 10.
Example:
1275 can be expanded as:-
5*1= 5
7*10= 70
2*100= 200
1*1000=1000
1275

2
Binary Number System (Base 2)
• Binary Number System comprises of two digits 0 & 1, thus, the base of the
binary number system is 2
• 2 digits {0, 1}, called binary digits or bits
• Same principals of position number systems applied to decimal number system
can be applied to binary number system. Consists of two digits 1 and 0 only.
• The base of binary number system is 2 e.g. 111110002, 1012, 11002. Magnetic
storage media for example uses the magnetic principle to initiate the two states 1
and 0 e.g. where the magnetized spot rep 1 while non-magnetized spot represent 0

Exponential 27 26 25 24 23 22 21 20
Integral Value 128 64 32 16 8 4 2 1

3
Arithmetic operation on Binary number systems

Addition of binary number systems

0+0=0
1+0=1
0+1=1
1+1=10 or 0 carry 1 to the next significant bit

Example 1:

10012+112=?
11 carries
1001
+11
11002 Leaving out the base 2 as indicated attracts a “0” mark

4
Example 2
11112+1112=?

111 carries
1111
+111
101102 Leaving out the base 2 as indicated attracts a “0” mark

Subtraction of binary number systems


0-0=0
1-0=1
1-1=0
0-1= Record 1 borrow 1 from the next bit to the left

Example 1
1102-112=?
00
110
-11
0112 answer=112

Example 2
1001102-110012=?
1 0
100110
-11001
01101 answer=11012

Conversion from Binary number system to decimal number system

The binary ("base two") numerical system has two possible values, often represented as 0 or
1, for each place-value. In contrast, the decimal (base ten) numeral system has ten possible
values (0, 1, 2, 3, 4, 5, 6, 7, 8, or 9) for each place-value. To avoid confusion while using
different numeral systems, the base of each individual number may be specified by writing it
as a subscript of the number. For example, the binary number 10011100 may be specified as

5
"base two" by writing it as 100111002. The decimal number 156 may be written as 15610 and
read as "one hundred fifty-six, base ten".

Conversion using positional notation Method


Example 1: Convert 100012 to decimal
Step 1: Write down the binary number and list the powers of 2 from right to left.
Let's say we want to convert the binary number 100012 to decimal. First, write it down. Then,
write down the powers of two from right to left. Start at 20, which evaluates to "1". Increment
the exponent by one for each power. Stop when the amount of elements in the list is equal to
the amount of digits in the binary number. The example number, 10001, has five digits, so the
list, with five elements, would look like this: 24, 23, 22, 21, 20 = 16, 8, 4, 2, 1

Step 2: Write the digits of the binary number below their corresponding powers of two
Now, just write the numbers 16, 8, 4, 2, 1 below the numbers 10001 so that each binary digit
corresponds with its power of two. The "1" to the right of the binary number should
correspond with the "1" on the right of the listed powers of two, and so on. You can also write
the binary digits above the powers of two, if you prefer it that way. What's important is that
they match up.
1 0 0 0 1
24 23 22 21 20
16 8 4 2 1

6
Step 3: Write down the final value of each power of two

Move through each digit of the binary number. Multiply each digit of the binary number
with its corresponding power of two
below it as shown in the table below
1 0 0 0 1
24 23 22 21 20
16 8 4 2 1
16 0 0 0 1

Step 4: Add the final values.


Now, add up the numbers written below the line. Here's what you do: 16 + 0 + 0 + 0 + 1 =
17. This is the decimal equivalent of the binary number 10001.

Step 5: Write the answer along with its base subscript.


Now, all you have to do is write 1710, to show that you are working with a decimal answer,
which must be operating in powers of 10.

Step 6: Use this method to convert a binary number with a decimal point to decimal
form
You can use this method even when you want to covert a binary number such as 1.12 to
decimal. All you have to do is know that the number on the left side of the decimal is in the
units’ position, like normal, while the number on the right side of the decimal is in the
"halves" position, or 1 x (1/2). The "1" to the left of the decimal point is equal to 20, or 1.
The
1 to the right of the decimal is equal to 2-1, or 0.5. Add up 1 and 0.5 and you get 1.510, which
is 1.12 in decimal notation.

This method can be modified to convert from any base to Decimal. The power is 2 because
the origin is base 2 (binary). If the origin is a different base, replace the 2 in the method with

7
the desired base. For example, if the origin is base 8, replace the 2 with 8. The final result
will then be in the desired base. (Wikihow, 2015)

Conversion from decimal number system to binary number system


The decimal (base ten) numeral system has ten possible values (0, 1, 2, 3, 4, 5, 6, 7, 8, or
9) for each place-value. In contrast, the binary (base two) numeral system has two
possible values represented as 0 or 1 for each place-value.

Conversion using Short Division by Two with Remainder

Step 1: Set up the problem.


Convert the decimal number 17710 to binary.
Write the decimal number as the dividend inside an upside-down "long division" symbol.
Write the base of the destination system (in our case, "2" for binary) as the divisor outside the
curve of the division symbol. This method is much easier to understand when visualized on
paper, and is much easier for beginners, as it relies only on division by two. To avoid confusion
before and after conversion, write the number of the base system that you are working with as a
subscript of each number. In this case, the decimal number will have a subscript of 10 and the
binary equivalent will have a subscript of 2.

Step 2: Divide
Write the integer answer (quotient) under the long division symbol, and write the remainder (0
or 1) to the right of the dividend. Since we are dividing by 2, when the dividend is even the
binary remainder will be 0, and when the dividend is odd the binary remainder will be 1.

177÷2=88 remainder 1

Step 3: Continue to divide until you reach 0


Continue downwards, dividing each new quotient by two and writing the remainders to
the right of each dividend. Stop when the quotient is 0.
177÷2=88 remainder 1
88÷2=44 remainder 0

8
44÷2=22 remainder 0
22÷2=11 remainder 0
11÷2=5 remainder 1
5÷2=2 remainder 1
3÷2=1 remainder 1
If the dividend is less than the divider then use the dividend the remainder i.e.
1÷2= 0 remainder 1

Step 4: Write out the new, binary number


Starting with the bottom remainder, read the sequence of remainders upwards to the top. For
this example, you should have 11110001. This is the binary equivalent of the decimal number
177. Or, written with base subscripts:
17710 = 111100012

This method can be modified to convert from decimal to any base. The divisor is 2 because the
desired destination is base 2 (binary). If the desired destination is a different base, replace the 2
in the method with the desired base. For example, if the desired destination is base 8, replace
the 2 with 8. The final result will then be in the desired base. (Wikihow, 2015)

Example
Convert 2510 to binary

9
Exercise:

Convert the following to their decimal equivalent


i. 100111002
ii. 111000112
iii. 1111112
iv. 1011.1012
Convert the following to their binary equivalent
i. 15710
ii. 18910
iii. 26510
iv. 40110

Octal Number Systems ( Base 8)


Same principal of positional number systems also apply to octal number systems. Its base is 8
and so each octal number system represents a successive power of 8, there are only 8 possible
digits i.e. 0, 1, 2, 3, 4, 5, 6, 7. Positional digits to the left of octal point carries weighted power
of 8.
e.g. 80 =1, 81=8, 82=64, 83=512, 84=4096, 85=32768
The system is more popular with microprocessor because number representatives in octal
number system can be used directly in input and output operations. E.g. 3678.
Octal binary
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

10
Table 1 showing octal numbers and their binary equivalence.

Hexadecimal Number system (Base 16)


Popularly known as Hex System, similar to octal system with exception that the base is 16
and there must be 16 digits. Well suited with big computers, most commonly used by
microprocessors and any CPU chip e.g Intel 8085, Has the following numbers
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}

Decimal 0-9
Alphabet A-F Represents 0-15

hexadecimal binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111

Table 2 showing hexadecimal numbers and their binary equivalence.

11
Converting octal numbers to Decimal number system

Example 1
3678
Method 1
3 6 7
82 81 80
64 8 1
192 48 7

192+48+7= 24710

Method 2
3678 = (3* 82) + (6*81) + (7*80)
= (3*64) + (6*8) + (7*1)
= 192+48+7
= 24710

Example 2
16018

1 6 0 1
83 82 81 80
512 64 8 1
512 384 0 1

512+384+0+1=89710

Example 3

12
142.018
1 4 2 . 0 1
82 81 80 . 8-1 8-2
64 8 1 . 0.125 0.15625
64 32 2 0 0.15625

64+32+2+0+0.15625=96.1562510

Converting decimal to octal


Use remainder method
i. Divide decimal number system by base
ii. Indicate the remainder to the right
iii. Continue dividing the quotient and indicating the remainder until the divide operation
produces a 0 quotient
iv. The base and number is the numeric remainder reading from last division to the first.

EXAMPLE 1

Convert 69110 to octal


69÷8=86 remainder 3 Read the remainders upwards (from bottom to top)
86÷8=10 remainder 6
10÷8=1 remainder 2
1÷8=0 remainder 1

Answer =12638

EXAMPLE 2

108010
1080÷8=135 remainder 0
135 ÷8= 16 remainder 7 Read Upwards
16 ÷ 8 = 2 remainder 0

13
2÷8=0 remainder 2

Answer = 20708

Converting Binary to Hexadecimal

Four binary digits are equivalent to one hexadecimal digit as shown in table 2 above.
Steps
i. Divide the binary number into groups of four digits starting on the right of the
binary number. E.g 100011001 becomes 1 0001 1001
ii. If the left most group has less than four bits put in the necessary number of
leading 0’s on the left 0001 0001 1001

iii. For each group of four bits write the corresponding number of hexadecimal digits

Example 1
1000110012

0001 0001 1001


1 1 9

Answer = 11916

Example 2
1011011112

0001 0110 1111


1 6 F

Answer = 16F16

14
Converting Hexadecimal to Binary

You write the corresponding groups of 4 binary digits in each Hexadecimal digit

Example 1
Covert BOA16 to binary
B 0 A
1011 0000 1010

Answer = 1011000010102

Example 2
1BE916
1 B E 9
0001 1011 1110 1001

Answer= 00011011111010012 OR (without the leading zeros) 11011111010012

Binary to octal conversion


3 binary digits are equivalent to one octal digit
Step
i. Divide the binary number into groups of three digits starting on the right of
the binary number. e.g 11011101 becomes 11 011 101
ii. If the left most group has less than three bits put in the necessary number of
leading 0’s on the left i.e 011 011 101
iii. For each group of three bits write the corresponding number of octal digits

15
Example 1

110111012

011 011 101


3 3 5

Answer = 3358

Example 2

11101110111102

001 110 111 011 110

1 6 7 3 6

Answer = 167368

Arithmetic Operation of Binary Numbers


Binary arithmetic is essential part of all the digital computers and many other digital
system.

1. Binary Addition
It is a key for binary subtraction, multiplication, division. There are four rules of binary
addition.

In fourth case, a binary addition is creating a sum of (1 + 1 = 10) i.e. 0 is written in the
given column and a carry of 1 over to the next column.

16
1. Example − Addition

2. Binary Subtraction
Subtraction and Borrow, these two words will be used very frequently for the binary
subtraction. There are four rules of binary subtraction.

1. Example − Subtraction

3. Binary Multiplication
Binary multiplication is similar to decimal multiplication. It is simpler than decimal
multiplication because only 0s and 1s are involved. There are four rules of binary
multiplication.

17
1. Example − Multiplication

4. Binary Division
Binary division is similar to decimal division. It is called as the long division procedure.

1. Example − Division

Octal arithmetic

1. Octal Addition
Following octal addition table will help you to handle octal addition.

18
To use this table, simply follow the directions used in this example: Add 68 and 58. Locate
6 in the A column then locate the 5 in the B column. The point in 'sum' area where these
two columns intersect is the 'sum' of two numbers.
68 + 58 = 138.

1. Example − Addition

2. Octal Subtraction
The subtraction of octal numbers follows the same rules as the subtraction of numbers
in any other number system. The only variation is in borrowed number. In the decimal
system, you borrow a group of 1010. In the binary system, you borrow a group of 2 10. In
the octal system you borrow a group of 810.

1. Example − Subtraction

Hexadecimal Arithmetic

19
1. Hexadecimal Addition
Following hexadecimal addition table will help you greatly to handle Hexadecimal
addition.

To use this table, simply follow the directions used in this example − Add A 16 and 516.
Locate A in the X column then locate the 5 in the Y column. The point in 'sum' area where
these two columns intersect is the sum of two numbers.
A16 + 516 = F16.

1. Example − Addition

2. Hexadecimal Subtraction
The subtraction of hexadecimal numbers follow the same rules as the subtraction of
numbers in any other number system. The only variation is in borrowed number. In the

20
decimal system, you borrow a group of 1010. In the binary system, you borrow a group of
210. In the hexadecimal system you borrow a group of 1610.

1. Example - Subtraction

Complements Arithmetic
Complements are used in the digital computers in order to simplify the subtraction
operation and for the logical manipulations. For each radix-r system (radix r represents
base of number system) there are two types of complements.

S.N. Complement Description

1 Radix Complement The radix complement is referred to as the r's complement

2 Diminished Radix Complement The diminished radix complement is referred to as the (r-1)'s
complement

1. Binary system complements


As the binary system has base r = 2. So the two types of complements for the binary
system are 2's complement and 1's complement.

1. 1's complement
The 1's complement of a number is found by changing all 1's to 0's and all 0's to 1's. This
is called as taking complement or 1's complement. Example of 1's Complement is as
follows.

21
2. 2's complement
The 2's complement of binary number is obtained by adding 1 to the Least Significant
Bit (LSB) of 1's complement of the number.
2's complement = 1's complement + 1
Example of 2's Complement is as follows.

22

You might also like