Beruflich Dokumente
Kultur Dokumente
Binary Addition
Binary Subtraction
Binary Multiplication
Binary Division
Binary Addition
10011
+ 1111101
_________
Binary Subtraction
Subtract the binary number 00111 from 10101 and show the
equivalent decimal subtraction.
111
10101
/ / / 21
00111 7
01110 = 14
Examples
1011011
- 10010
__________
1010110
- 101010
__________
Binary Multiplication
00=0
01=0
10=0
11=1
Binary Division
1101 / 11
1001010/1000
Octal Addition
(162)8 + (537)8
(136)8 + (636)8
(67.5)8 + (45.6)8
Hexadecimal Addition
(4A6)16 + (1B3)16
(BA3)16 + (5DE)16
Complement of numbers
Radix complement: rs complement
Diminished Radix complement: (r-1)s
complement
0 0 1 1 0 1 0 1
2s Complement
0 0 1 1 0 1 0 1
0 0 1 1 0 1 1 0
Find the 1s and 2s complement of
1101100
0010011 <- 1s complement
0010101 <- 2s complement
Signed Binary numbers
In the real world of mathematics, computers
must represent both positive and negative
binary numbers.
Even when dealing with positive arguments,
results may be negative!
124- 237 = 113.
1s complement
2s complement
Disadvantage:
Increased number of bits
Can result in +0 and -0 which is illogical.
Can make Math more difficult since the
first bit needs to be ignored in
calculations
Arithmetic with sign-magnitude
numbers
If signs are the same:
Add both magnitudes and give answer the
same sign.
If +5 = 0101
-5 = 1010
But,
if m 00000000 then its 1s
complement is 11111111;
there are two zeros in this method as
well.
2s complement
Overcoming the problems faced by the
previous 2 methods, this is the most
preferred method.
If +5 = 0101
-5 = 1011
Look at MSB to determine if it is representing
a positive or a negative number.
2s complement
Another way to understand this:
1 0 1 1 = -8 + 2 + 1 = -5
For decoding:
Look for a continuous trail of 1s and consider only the rightmost 1 as the
sign bit, and perform 2s complement for the numbers to the right of that 1.
0 0 0 1 0 1 0 0 = -16 + 4 = -12
Comparison between different
representations
Addition
Examples:
00011110 = +30 00001110 = +14 11111111 = 1
00001111 = +15 11101111 = 17 11111000 = 8
00101101 = +45 11111101 = 3 1 11110111= 9
Subtraction
Rules for subtraction: 2s complement the subtrahend and add the
numbers. Discard any final carries. The result is in signed form.
Odd parity:
T
Suppose you receive a binary bit
word 0101 and you know you are
using an odd parity.
Is the binary word correct?