NUMBER OPERATION
The four main number operations in binary number is
addition, subtraction, multiplication and division.
BINARY ADDITION
Rules of Binary Addition
Sum
|
Carry
|
|
0 + 0 = 0
|
0
|
0
|
0 + 1 = 1
|
1
|
0
|
1 + 0 = 1
|
1
|
0
|
1 + 1 = 1
|
0
|
1
|
Example:
1. 100011 + 000101 = 101000
1 1 1 = carries
1 0 0 0 1 1
= 35(base 10)
+0 0 0 1 0 1 = 5 (base 10)
__________
1 0 1 0 0 0 = 40 (base 10)
+0 0 0 1 0 1 = 5 (base 10)
__________
1 0 1 0 0 0 = 40 (base 10)
2. 01011001 +
01101101 = 11000110
1 1 1 1 = carries
0 1 0 1 1 0 0 1 = 89( base 10)
+ 0 1 1 0 1 1 0 1 = 109(base 10)
_____________
1 1 0 0 0 1 1 0 = 198(base 10)
0 1 0 1 1 0 0 1 = 89( base 10)
+ 0 1 1 0 1 1 0 1 = 109(base 10)
_____________
1 1 0 0 0 1 1 0 = 198(base 10)
3. 11000.11
+ 11.11 = 11100.10
1 1 1 1 =
carries
1 1 0 0 0. 1 1 = 24.75 (base 10)
+ 1 1. 1 1 = 3.75 (base 10)
______________
1 1 1 0 0. 1 0 = 28.50 (base 10)
1 1 0 0 0. 1 1 = 24.75 (base 10)
+ 1 1. 1 1 = 3.75 (base 10)
______________
1 1 1 0 0. 1 0 = 28.50 (base 10)
Two’s Compliment Addition
Example:
-15 + 10 = 1111 0001 + 0000 1010
= 1111 1011
1st step: Change -15 into 2nd
complement number
binary number for -15 : 0000 1111
1st complement : 1111 0000
2nd complement : 1111 0001
Example:
1 1 1 1 0 0 0 1 = -15 (base 10 )
+0 0 0 0 1 0 1 0 = +10 (base 10)
______________
1 1 1 1 1 0 1 1 = -5 (base 10)
Overflow will occur when
two 2nd complement’s number is add together with same sign
(both positive and both negative). Overflow never occurs when adding operands with
different signs.
The
situation below will occur overflow:
(+A) + (+B) = - C
(-A) + (-B) = + C
(-A) + (-B) = + C
Example: -5 + -3 = -8
1 0 1 1
+ 1 1 0 1
________
overflow ---- 1 1 0 0 0
+ 1 1 0 1
________
overflow ---- 1 1 0 0 0
BINARY
SUBTRACTION
Rules of Binary Subtraction
Sum
|
Borrow
|
|
0 – 0 = 0
|
0
|
0
|
0 – 1 = 1
|
1
|
10
|
1 – 0 = 1
|
1
|
0
|
1 – 1 = 1
|
0
|
1
|
Two’s Compliment Subtraction
Overflow occurs when 2
two’s complement numbers with different sign is subtracted.
The situation below will occur overflow:
(+A) – (- B) = -C
(- A) – (+ B) = +C
(+A) – (- B) = -C
(- A) – (+ B) = +C
BINARY MULTIPLICATION
Rules of Multiplication
Multiply
|
|
0 x 0 = 0
|
0
|
0 x 1 = 0
|
0
|
1 x 0 = 0
|
0
|
1 x 1 = 1
|
1
|
BINARY DIVISION
Written by:
Name:Woon
Pei Wen,Loo Shi Min
No.Matrik : B031210273,B031210106








No comments:
Post a Comment