DE Unit 1

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

Unit-1

Number System

The number system is a system in which an ordered set of digits are used to specify any
number.

Decimal Number System

The number system that we use in our day-to-day life is the decimal number system. Decimal
number system has base 10 as it uses 10 digits from 0 to 9. In decimal number system, the
successive positions to the left of the decimal point represent units, tens, hundreds, thousands,
and so on.

Each position represents a specific power of the base (10). For example, th e decimal number 1234
consists of the digit 4 in the units position, 3 in the tens position, 2 in the hundreds position, and
1 in the thousands position. Its value can be written as

(1 x 1000)+ (2 x 100)+ (3 x 10)+ (4 x l)


(1 x 10 3)+ (2 x 10 2)+ (3 x 10 1)+ (4 x l0 0)
1000 + 200 + 30 + 4
1234

As a computer programmer or an IT professional, you should understand the following number


systems which are frequently used in computers.

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 1
Note: The material is prepared for private Circulation only.
Binary Number System

Characteristics of the binary number system are as follows −

• Uses two digits, 0 and 1

• Also called as base 2 number system

• Each position in a binary number represents a 0 power of the base (2). Example 2 0

• Last position in a binary number represents a x power of the base (2). Example
2 x where x represents the last position - 1.

Example

Binary Number: 101012

Calculating Decimal Equivalent −

For example, (101101)2 in decimal is


= 1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
= 1 x 32 + 0 x 16 + 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1
= 32 + 8 + 4 + 1
= (45)10

Octal Number System

Characteristics of the octal number system are as follows −

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 2
Note: The material is prepared for private Circulation only.
• Uses eight digits, 0,1,2,3,4,5,6,7

• Also called as base 8 number system

• Each position in an octal number represents a 0 power of the base (8). Example 8 0

• Last position in an octal number represents a x power of the base (8). Example
8 x where x represents the last position – 1

Example

Octal Number: 12570 8

Calculating Decimal Equivalent –

For example, (24)8 in decimal is


= 2×8 1+4×8 0
= (20)10

Hexadecimal Number System

Characteristics of hexadecimal number system are as follows −

• Uses 10 digits and 6 letters, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 3
Note: The material is prepared for private Circulation only.
• Letters represent the numbers starting from 10. A = 10. B = 11, C = 12, D = 13, E = 14, F
= 15

• Also called as base 16 number system

• Each position in a hexadecimal number represents a 0 power of the base (16). Example,
16 0

• Last position in a hexadecimal number represents a x power of the base (16). Example
16 x where x represents the last position - 1

Example

Hexadecimal Number: 19FDE16

Calculating Decimal Equivalent −

Binary Addition

Binary addition technique is similar to the normal addition of decimal numbers excluding that as
an alternative value of 10 digits, it carries on a 2 value.

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 4
Note: The material is prepared for private Circulation only.
For example, as we compute 7+9 manually, then the answer is 16. So we know that the result has
to write like two digits 1 and 6. The main reason to write down the result like 1 6 is, the addition
of 7 + 9 is greater than the single digit. So the result cannot be denoted thro ugh a single digit
because the largest single digit is ‘9’.

Similarly, whenever we would like to sum two binary numbers, only we will have a carry if the
product is bigger than 1 because, in binary numbers, 1 is the highest number. The binary addition
rules are given in the following truth table of subtraction.

In the above tabular form, the initial three equations are the same for the binary digit number. The
addition of binary numbers step by step is explained in detail. For binary addition take an example
of 11011 & 10101.

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 5
Note: The material is prepared for private Circulation only.
Here the step by step binary addition rules is explained below

1 + 1 => 1 0, so 0 with a carry 1


1 + 1 + 0 => 1 0. So 0 with carry 1
1+0+1 => 10 => 0. So 0 with carry-1
1+1+0 => 10 => 10 = 0 with carry-1
1+1+1=> 10+1 => 11= 1 with carry-1
1 +1 +1 = 11

Carefully note that 10 + 1 => 11 and this is equal to 2 + 1= 3. Therefore the

necessary outcome is 111000.

Examples

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 6
Note: The material is prepared for private Circulation only.
Binary Subtraction: First Method

In subtraction, this is the primary technique. In this method, ensure that the subtracting number
must be from a larger number to smaller, or else this technique won’t work appropriately.

If the minuend is smaller than the subtrahend, then this method is used by just switch their positions
and memorize that the effect will be a -ve number. The binary subtraction rules are given in the
following truth table of subtraction.

For example, in the binary subtraction, subtract the subtrahend from minuend. Take an example
of subtrahend (110112) and minuend (11011012). For subtraction, arrange these two like the
subtrahend should be below the minuend. The example of this is given below.

1101101
– 11011

To get the same number of digits in subtrahend, add zeros where it requires.

1101101
– 0011011

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 7
Note: The material is prepared for private Circulation only.
________
1010010

In the above binary subtraction example, the subtraction was achieved from the right side to the
left side with the help of tabular form which is shown in the above. Here the step by step binary
subtraction rules is explained below.

If the input 1 1 = 0, then borrow to the next step is 0.

If the input 0 1 = 1 & borrow is 0. So 1 0 = 1 then borrow to the next step is 1.

If the input 1 0 = 0 & borrow is. So 1 1 = 0 then borrow to the next step is 0.

If the input 1 1 = 0 & borrow is 0. So 0 0 = 0 then borrow to the next step is 0.

If the input 0 1 = 1 & borrow is 0. So 1 0 = 1 then borrow to the next step is 1.

If the input 1 0 =1 & borrow is 1. So 1 1 = 0, then borrow to the next step is 0.

Final step, If the input 1 0 = 0 & borrow is 0. So 10 = 1, then borrow to the next step is 0.

So the final result will be 1010010

Second Method: Two’s Complement

First, confirm that the digits in the subtrahend and minuends should be equal. In the above
example, the digits in the minuends have 7 whereas in subtrahend the digits are 5. So we need to
extend the digits in subtrahend by adding zeros. A 2’s complement of a number can be achieved
by complementing each digit of the number like zero’s to ones and ones to zeros. Finally, add one
to one’s complement. An example of this two’s complement is shown below.

0011011

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 8
Note: The material is prepared for private Circulation only.
1’s complement can be achieved by converting 0’s to 1’s and 1’s to 0’s. So the result will be like
the following.

0011011 – – – -> 1100100 (1’s complement)


2’s complement can be achieved by adding 1 to 1’s complement. So the result will be like the
following.

1100100
+ 0000001
_________
= 1100101
Now add the subtrahend‘s 2’s complement & minuend.

1101101 (subtrahend)
+ 1100101 (2’s complement)
________
(MSB) (1)1010010
In the above result, ignore the MSB (most significant bit) of the outcome. If there is no
additional bit, you did a mistake while adding the digits.

Examples
The binary subtraction examples are shown in the following figure.

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 9
Note: The material is prepared for private Circulation only.
9’s Complement in Decimal Number System

The 9’s complement of a number can be obtained by subtracting every digit of a number by 9.
Consider some numbers such as 6, 27, 234, 672 and the 9’s complement of these numbers can be
obtained as:-

9-6 = 3, 99-27 = 72, 999-234 = 765, 999-672 = 327, thus 3, 72, 234, 672 are the 9’s complement
of the numbers described above.

Significance of 9’s Complement

The procedure of subtraction can be done in much easier steps with the aid of 9’s complement.
When we subtract two numbers then we subtract the subtrahend from minuend but with 9’s
complement we need not to do subtraction when we are using 9’s complement.

In this procedure we just need to add 9’s complement of the subtrahend to the minuend. When
we subtract the smaller number from the larger one, the 9’s complement of subtrahend when
added with minuend will result in the formation of carry. We need to add this carry to the result.
The resultant addition will be the final answer.

While when we subtract larger number from the smaller one the result of the addition of the
subtrahend with minuend will not produce any carry. When addition of 9’s complement doesn’t
generate any carry it indicates that the resultant product is negative. The final answer can be
obtained by again taking the 9’s complement of this number.

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 10
Note: The material is prepared for private Circulation only.
10’s Complement in Decimal Number System

The 10’s complement of the any decimal number can be obtained by adding 1 to the 9’s
complement of the same number. Let’ see the steps to find 10’s complement.

1. Find the 9’s complement of the number by subtracting every digit of the number
from 9.

2. The number thus obtained by subtraction will be added with 1.

3. Thus, 10’s complement of the number is obtained.

4. Therefore, 10’s complement is 9’s complement + 1.

Consider some decimal numbers 7, 34, 566, 3456, now let’s find 9’s complement of each of
these.

9-7 = 2, 99-34 = 65, 999-566 = 433, 9999-3456 = 6543

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 11
Note: The material is prepared for private Circulation only.
Thus, 2, 65, 433 & 6543 are the 9’s complement of the above considered numbers. Now, in order
to find 10’s complement of these numbers let’s add 1 to each of these numbers.

2+1 = 3, 65+1 = 66, 433+1 = 434, 6543+1 = 6544

Thus, 3, 66, 434 & 6544 are the 10’s complement of the numbers 7, 34, 566, 3456 respectively.

Significance of 10’s complement

The 10’s component of the decimal number is crucial in subtracting one number from other. The
subtraction can be achieved with the help of addition of 10’s complement of subtrahend with
minuend. In this again two cases will arrive which are as follows:-

(i) When a smaller number is to be subtracted with the larger number, in this case one carry will
be generated. Ignore this carry and the rest of the digits of the addition will be the a nswer.

(ii) When a larger number is to be subtracted from the smaller number, in this case the answer
will be negative. There will be no carry generation after addition of the 10’s complement of
subtrahend with minuend. This indicates that the resultant answer is negative. The final answer
can be evaluated by taking the 10’s complement of the number which is obtained after addition
of 10’s complement of subtrahend with minuend.

Unit-1, Digital Electronics ,IVth Sem, Dept. of Instumentation Engg., IoPE, Lonere (Prepared by Mrs.S.S.Swami) Page 12
Note: The material is prepared for private Circulation only.

You might also like