Binary Addition
Binary Subtraction
Binary Division
- 0 + 0
= 0
- 0 + 1
= 1
- 1 + 0
= 1
- 1 + 1
= 0,
and carry 1 to the next more significant bit
For example,
00011010
+ 00001100 = 00100110
|
1 1
|
carries
|
||
0 0 0 1 1 0 1 0
|
=
|
26(base
10)
|
||
+ 0 0 0 0 1 1 0 0
|
=
|
12(base
10)
|
||
0 0 1 0 0 1 1 0
|
=
|
38(base
10)
|
||
Note: The rules of binary addition (without
carries) are the same as the truths of the XOR gate.
Binary Subtraction
- 0 - 0
= 0
- 0 - 1
= 1,
and borrow 1 from the next more significant bit
- 1 - 0
= 1
- 1 - 1
= 0
For example,
00100101
- 00010001 = 00010100
|
0
|
borrows
|
||
0 0
|
=
|
37(base
10)
|
||
- 0 0 0 1 0 0 0 1
|
=
|
17(base
10)
|
||
0 0 0 1 0 1 0 0
|
=
|
20(base
10)
|
Binary Multiplication
- 0 x 0
= 0
- 0 x 1
= 0
- 1 x 0
= 0
- 1 x 1
= 1,
and no carry or borrow bits
For example,
00101001 × 00000110 = 11110110
|
0 0 1 0 1 0 0 1
|
=
|
41(base 10)
|
|
× 0 0 0 0 0 1 1 0
|
=
|
6(base 10)
|
||
0 0 0 0 0 0 0 0
|
||||
0 0 1 0 1 0 0 1
|
||||
0 0 1 0 1 0 0 1
|
||||
0 0 1 1 1 1 0 1 1 0
|
=
|
246(base 10)
|
Note: The rules of binary multiplication are the
same as the truths of the AND gate.
Binary division is
the repeated process of subtraction, just as in decimal division.
For example,
00101010 ÷ 00000110 = 00000111
|
1
|
1
|
1
|
=
|
7(base 10)
|
||||||||
1 1 0
|
)
|
0
|
0
|
10
|
1
|
0
|
1
|
0
|
=
|
42(base 10)
|
|||
-
|
1
|
1
|
0
|
=
|
6(base 10)
|
||||||||
1
|
borrows
|
||||||||||||
10
|
1
|
||||||||||||
-
|
1
|
1
|
0
|
||||||||||
1
|
1
|
0
|
|||||||||||
-
|
1
|
1
|
0
|
||||||||||
0
|
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.