











































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












































Integers Arithmetic Representation Addition and subtraction Multiplication and Division
Integers- numbers without decimal point/fraction parts Arbitrary representation binary numbers could be: (^) -1101.01012 = -13. 10 For purposes of computer storage and processing, however, we do not have the benefit of minus signs and periods. Only binary digits (0 and 1) may be used to represent numbers.
There are several drawbacks to sign- magnitude representation. (^) One is that addition and subtraction require a consideration of both the signs of the numbers and their relative magnitudes to carry out the required operation. (^) Another drawback is that there are two representations of 0:
Twos Complement Representation 2’s complement = 1’s complement + 1’s complement = 0’s to 1 and 1’s to 0 Like sign magnitude, twos complement representation uses the most significant bit as a sign bit, making it easy to test whether an integer is positive or negative. It differs from the use of the sign- magnitude representation in the way
2’s complement addition: (^) If the operand to add is negative convert to 2’s complement, then add If the result of the operation is positive, we get a positive number in true binary form If the result of the operation is negative, we get a negative number in twos complement form (^) N.B discard carry while addition of MSB (^) Overflow occurs if sum cannot be expressed with the same bit of operands including sign bit. (^) E.g -7+5, -7+-
To subtract one number (subtrahend) from another (minuend), take the twos complement (negation) of the subtrahend and add it to the minuend. E.g 2-7,5-2,….
Efficient paper and pencil multiplication using HW
(^) Straight forward multiplication will not work if both, or either of multiplier and multiplicand is negative (^) To demonstrate why we need to remember: (^) the multiplication of a binary number by is accomplished by shifting that number to the left n bits (^) E.g
Straight forward multiplication will not work if multiplicand is negative: The problem is that each contribution of the negative multiplicand as a partial product must be a negative number on a 2n-bit field; the sign bits of the partial products must line up. Note that this is accomplished by padding out each partial product to the left with binary 1s.
Straight forward will not work if multiplier is negative (^) The reason is that the bits of the multiplier no longer correspond to the shifts or multiplications that must take place (^) E.g -3 = 1101 in 2’s complement 1101 = -(12^3 +12^2 +02^1 +12^0 ) (^) But it need to be –(12 (^1) +12 (^0) ) to get correct result So this multiplier cannot be used directly in the manner we have been describing. (^) Solution- use Booth’s Algorithm
Use booth’s algorism to find product of: A) 7- B)-7 C)-7*-
Paper and Pencil approach(long division): (^) First, the bits of the dividend are examined from left to right, until the set of bits examined represents a number greater than or equal to the divisor; this is referred to as the divisor being able to divide the number. (^) Until this event occurs, 0s are placed in the quotient from left to right. (^) When the event occurs, a 1 is placed in the quotient and the divisor is subtracted from the partial dividend. The result is referred to as a partial remainder