"O GOD THEE I PRAY INCREASE MY KNOWLEDGE DAY BY DAY"

.

For Success

For Success
Know more than other Work more than other But, Expect less than other

Its a necessary and sufficient condition-----

Its a necessary and sufficient condition-----
"If you win, you need not have to explain.........But if you lose, you should not be there to explain!"

07 October 2010

binary airthmetic

BINARY ARITHMETIC

The binary numeral system or base 2 number system is numeral system that represents numeric values using two symbols usually 0 and 1. More specifically, the usual base 2 system is a positional notation with a radix of 2. Owing to its straight forward implementation digital electronic circuitry using logic gates, the binary system is used internally by all modern computers.
A binary number can be represented by any sequence of bits (binary digits) which in turn may be represented by any mechanism capable of being in two mutually exclusive states.

The following sequence of symbols could all be interpreted as the same binary numeric values of 667.

1 0 1 0 0 1 1 0 1 1
x o x o o x x o x x
y n y n n y y n y y

the usual arithmetic taught in school uses the decimal number system. A number such as 394 [three hundred ninety four] is called a decimal number.

394 = 3 x 100 + 9 x 10 + 4 x 1
= 3 x 102 + 9 x 101 + 4 x 100

The number is also said to be written in base 10. the position of the digits in a particular number indicates the magnitude of the quantity represented and can be assigned a weight.

Binary digits also follow some rules and regulation for arithmetic operations as like as decimal numbers . in this chapter we will discuss these operations:








ADDITON :-
Binary addition is carried out in the same way as decimal addition. The rules for four possible additions of two binary numbers A and B and their results are given in table below:

A B Sum
0 + 0 0
0 + 1 1
1 + 0 1
1 + 1 10

The last addition viz. 1+1 = 10 may be understood clearly. This is so written because the largest digit in the binary system is 1. the result of the sum greater than 1 will require that a digit be carried over. Hence, the last addition, in fact, implies that 1+1 = 0 plus a carry of 1 to the next right column. Thus for further addition, the above table may be rewritten as follows:-



A B Sum Carry
0 + 0 0 0
0 + 1 1 0
1 + 0 1 0
1 + 1 0 1
1+1+1 1 1

For addition of 3 or more bits, two bits are added at a time and the above rules are repeated for further additions



E X . Add 10111111 and 11111101


carry 1111111
10111111
+ 11111101
Ans: 110111100

Practice: add these
1. 101+111
2. 1111+1011
3. 1010101+1111000
4. 110101+10001
5. 10111111+11111111
Answers:
1.1100, 2. 11010, 3. 11001101, 4. 1000110, 5. 110111110

SUBTRACTION:
As like as decimal system binary subtraction is same.
Subtrahend- S-number to be subtracted
Minuend- M- number from which other number subtracted
In this operation we have to check which is greater –subtrahend or minuend
If M > S, then subtraction is performed.
If S > M, then borrow is required from left column- In decimal borrower is 10 , but in binary borrower is 2

RULES :-

A B Subtraction
0 - 0 0
0 - 1 1 ( with a borrow of 1)
1 - 0 1
1 - 1 0


Ex. Subtract 1101 from 10011

BORROW 012
10011
- 01101
Ans: 00110




BORROW 012
10101001
- 10011111
Ans: 00001010

Practice & check :
1. 110101-10001=100100
2. 1010101-101001=101100
3. 10011-01111=00100


Additive method of Subtraction/ Complementary subtraction:

Rules & regulation for this:
1. Find the complement of Subtrahend
2. Then, Complement of S + Minuend
Now there can be two conditions occurs:
If no carry- then find the recomplement of the sum( previous result)- & attach a –ve sign with the result
If a carry comes then add it to obtained result

Example: Subtract 10011111 from 10101001 using addative approach
Step-1 complement of 10011111= 01100000
Step-2 10101001
+01100000
00001001
Carry + 1
Result 00001010

Example: Subtract 1000 from 0101
Step:1 Complemnet of 1000 is 0111
Step:2 0101
0111
+1100- With no carry
Step 3 complement of 1100 is 0011
Result is = - 0011


MULTIPLICATION

RULES :- There are only 4 conditions.
s
A B Multiplication
0 * 0 0
0 * 1 0
1 * 0 0
1 * 1 1
Ex.
1110
x 1011
——————
1110
1110x
0000xx
1110xxx
—————
10011010
—————

Practice:
Multiply these and prove it
1110*1011= 10011010
11101*1100 =101011100

Additive method of multiplication:
This approach is simpler but very lengthy. Mostly computers use this approach due to their high speed to perform operations.



DIVISION

RULES :-
there only two conditions.
0/1=0
1/1=1
• compare divisor with dividend.
• If , dividend > divisor
Then, take value of quotient 1 and subtract the divisor from the corresponding digits of dividend.
If , Divisor > Dividend
Then, take value of the quotient 0 and repeat whole process till sufficient digits in dividend
Exmple: Divide a binary digit 1010 by binary 10

Divisor Dividend quotient
10 1010 101
10
0010
10
0000 –Reminder
Exmple: Divide a binary digit 1100111 by binary 111

Divisor Dividend quotient
111 1100111 01110
111
1011
111
1001
111
101 --Reminder


Additive method:
Example: Divide 10001 by 110
10001 - 110 = 01011 1
1011 – 110 = 0101 – reminder 1
Quotient 10

No comments:

Post a Comment