Number Systems
Number Systems
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.
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
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
Example 1
1102-112=?
00
110
-11
0112 answer=112
Example 2
1001102-110012=?
1 0
100110
-11001
01101 answer=11012
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".
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 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)
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
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
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:
10
Table 1 showing octal numbers and their binary equivalence.
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
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
EXAMPLE 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
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
Answer = 11916
Example 2
1011011112
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
15
Example 1
110111012
Answer = 3358
Example 2
11101110111102
1 6 7 3 6
Answer = 167368
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.
2 Diminished Radix Complement The diminished radix complement is referred to as the (r-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