2. BINARY ADDITION
• Four most basic cases of binary addition
• Column-by-column addition applies to binary as well as decimal
numbers.
• Start by adding the least-significant column.
• Example 1:
3. Example 2: Add these 8-bit numbers: 0101 0111 and 0011 0101. Then,
show the same numbers in hexadecimal notation.
• Expressed in hexadecimal numbers, the foregoing addition is,
4.
5. BINARY SUBTRACTION
• Four most basic cases of binary Subtraction
• Subtract column by column, the same as you do with decimal numbers.
• Start by subtracting the least-significant column.
• To subtract the bits of the second column, you may borrow from the
next-higher column.
• Example 1 :
7. UNSIGNED BINARY NUMBERS
• In unsigned binary numbers all of the bits are used to represent the
magnitude of the corresponding decimal number. we can add and
subtract unsigned binary numbers, provided certain conditions are
satisfied.
Limits
• With 8-bit unsigned arithmetic, all magnitudes must be between 0 and
255. Therefore, each number being added or subtracted must be
between 0 and 255. Also, the answer must fall in the range of 0 to 255. If
any magnitudes are greater than 255, we should use 16-bit arithmetic,
which means operating on the lower 8 bits first, then on the upper 8
bits.
Overflow
• In 8-bit arithmetic, addition of two unsigned numbers whose sum is
greater than 255 causes an overflow, a carry into the ninth column.
8.
9.
10. SIGN-MAGNITUDE NUMBERS
• The Sign magnitude numbers contain a sign bit followed by magnitude
bits. Numbers in this form are called sign-magnitude numbers.
• 0 is used for the + sign and 1 for the - sign. Therefore, -001, -010, and-
011 are coded as 1001, 1010, and 1011.
• The MSB always represents the sign, and the remaining bits always
stand for the magnitude.
• some examples of converting sign-magnitude numbers:
11. Range of Sign-Magnitude Numbers
• When we use sign-magnitude numbers, the largest magnitude is 127
because we need to represent both positive and negative quantities.
• As long as our input data is in the range of -127 to + 127, we can use 8-bit
arithmetic.
• With 8 bit numbers, its range is from -127 to +127.
• The main advantage of sign-magnitude numbers is their simplicity.
Negative numbers are identical to positive numbers, except for the sign
bit. Because of this, we can easily find the magnitude by deleting the sign
bit and converting the remaining bits to their decimal equivalents.
• Question: In sign-magnitude form, what is the decimal value of 1000
1101? Of 0000 1101?
12. 1 's Complement
• The 1's complement of a binary number is the number that results
when we complement each bit.
• For example, The 1’s complement of 1010 is 0101.
13.
14. Things to remember about 2' s complement
representation:
• 0 is always considered as a positive number.
• Its range is from -2n-1 to 2n-1 – 1. i.e. we can represent -8 to 7 using 4
bits.
• Positive numbers always have a sign bit of 0, and negative numbers
always have a sign bit of 1.
• Positive numbers are stored in sign-magnitude form.
• Negative numbers are stored as 2's complements.
• Taking the 2's complement is equivalent to a sign change.
15. 2'S. COMPLEMENT ARITHMETIC
Addition
• Augend and Addend is represented in 2’s complement representation.
• Addition is done column by column starting form LSB.
• Discard the carry in last column if exists.
• If two numbers of same sign are added and the result is of opposite
sign, then such condition is said to be Overflow.
Perform the following using 2’s complement representation. Represent
each number using 8 bits.
1) (83)10 + (16)10 6)(100)10 + (50)10
2) (125)10 + (-68)10 7)(-85)10 + (-97)10
3) (37)10 + (-115)10
4) (-43)10 + (-78)10
16. 2’s complement Subtraction
• Minuend and Subtrahend is represented in 2’s complement
representation.
• Take the 2’s complement of Subtrahend and add it to the Minuend.
• The addition follows the rules as described in previous topic.
Perform the following using 2’s complement representation. Represent
each number using 8 bits.
1) (83)10 - (16)10
2) (68)10 - (-27)10
3) (14)10 - (-108)10
4) (-43)10 - (-78)10