![]() The (incorrect) answer is a positive twenty-eight. Let’s try adding -17 10 and -19 10 together to see how this works (or doesn’t work, as the case may be!): Simply put, six places doesn’t give enough bits to represent the correct sum, so whatever figure we obtain using the strategy of discarding the left-most “carry” bit will be incorrect.Ī similar error will occur if we add two negative numbers together to produce a sum that is too low for our six-bit binary field. The answer lies in the restrictions of the six-bit number field within which we’re working Since the magnitude of the true and proper sum (36 10) exceeds the allowable limit for our designated bit field, we have an overflow error. The answer (100100 2), interpreted with the sixth bit as the -32 10 place, is actually equal to -28 10, not +36 10 as we should get with +17 10 and +19 10 added together! Obviously, this is not correct. ![]() Let’s try adding 17 10 and 19 10 to see how this overflow condition works for excessive positive numbers: If we set up an addition problem with two binary numbers, the sixth bit used for sign, and the result either exceeds +31 10 or is less than -32 10, our answer will be incorrect. This means that we can represent a number as high as +31 10 (011111 2), or as low as -32 10 (100000 2). With five bits to represent magnitude, we have a representation range of 2 5, or thirty-two integer steps from 0 to maximum. With the last example problem, we used five binary bits to represent the magnitude of the number, and the left-most (sixth) bit as the negative-weight, or sign, bit. Remember that the place of the sign bit is fixed from the beginning of the problem. One caveat with signed binary numbers is that of overflow, where the answer to an addition or subtraction problem exceeds the magnitude which can be represented with the allotted number of bits.
0 Comments
Leave a Reply. |