MGMT 1030 Lecture Notes - Lecture 30: Subtraction
MGMT 1030 Lecture 30 Notes – Complement Scale
Introduction
• Both ad epeset , speifially, + ad −, espetiely.
• The ’s opleet sale fo -bit binary numbers is shown
• Addition also works in the same way.
• To add two numbers, regardless of the implied sign of either input, the computer simply
adds the numbers as though they were unsigned integers.
• If there is a carryover into the next bit beyond the leftmost specified bit, 1 is added to
the result, following the usual end-around carry rule.
• Subtraction is done by inverting the subtrahend (i.e., changing every 0 to 1 and every 1
to 0) and adding.
• Overflows are detected in the same way as previously discussed
• If both inputs are of the same sign
• The sign of the result is different, overflow has occurred
• The result is outside the range.
• Notice that this test can be performed simply by looking at the leftmost bit of the two
inputs and the result.
• An important comment about conversion between signed binary and decimal integers in
their complementary form
• Although the tehiue used is idetial etee ’s opleet deial
• ’s opleet iay
• The modulus used in the two systems is obviously not the same!
• For example, the modulus in three-digit decimal is 999, with a positive range of 499.
• The modulus in 8-bit binary is 11111111, or 25510, with a positive range of 01111111,
or 12710.
• This eas that you aot oet dietly etee ’s opleet deial ad ’s
complement binary.
find more resources at oneclass.com
find more resources at oneclass.com