

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This home work exercise is very helpful for the student of discrete mathematics. The major points in the exercises are: Computer Arithmetic, 8-Bit Two's Complement, Decimal Number, Modulation Operations, First Iteration, Binary Number, Decimal Representation, Complement of Number, Mutual Relation, Base-2 Arithmetic
Typology: Exercises
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Find the 8-bit two’s complement of 67 10. We first convert it into binary format then calculate its two’s comple- ment. We iteratively divide this decimal number by 16 and set each digit (from lowest to highest) to be the remainder. For instance, 67 10 /2 = 33 and 6710 mod 2 = 1, so the first bit is set to be 1, and we replace 67 with 33 for the following division and modulation operations. In the end the binary number is 1000011, which is only of 7 bits, so we add 0 to the high-end bit and make it to be 01000011. The two’s complement is thus obtained by flip all the bits then add it by 1, which turns out to be 10111101.
Find the 8-bit two’s complement of 108 10. As above, we first convert it into binary format then calculate its two’s complement. We iteratively divide this decimal number by 16 and set each digit (from lowest to highest) to be the remainder. For instance, originally for the first iteration, we have 108 10 /2 = 54 and 108 10 mod 2 = 0, so the first bit is set to be 10, and we replace 108 with 54 for the following division and modulation operations. In the end the binary number becomes 1101100, which is only of 7 bits, so we add 0 to the high-end bit and make it to be
The number 10001001 2 is the 8-bit two’s complement of a number k. What is the decimal representation of k? For every n-bit number a, its two’s complement, b, is calculated as b = 2 n^ − a. Notice that from this equation we can also obtain a = 2n^ − b, thus a is also the two’s complement of b, and it is a mutual relation. As a result, we can get the original binary number of k by flip all the bits of its two’s complement and add by one, which is 01110111 2. The decimal representation turns out to be 119.
The number 10111010 2 is the 8-bit twos complement of a number k. What is the decimal representation of k? Similar as above, for every n-bit number a, its two’s complement, b, is calculated as b = 2n^ − a. Notice that from this equation we can also obtain a = 2n^ − b, thus a is also the two’s complement of b, and it is a mutual relation. As a result, we can get the original binary number of k by flip all the bits of its two’s complement and add by one, which is 01000110 2. The decimal representation turns out to be 70.
Using base-2 arithmetic, compute 79 - 43. Then compute it using 8-bit two’s- complement registers. Remember to check for overflow. We first convert the two numbers into 8-bit binary formats, using the method as denoted above. 79 → 010011112 and 43 → 001010112. Then since 79 > 43, we take binary arithmetic operation on them and get the result as 00100100 2. In the other way, using two’s complement, we first convert the negative number −43 to be 11010101 2 and take the addition operation with 01001111 2. Notice that any carry bit is seen as overflow and will be discarded, and after bitwise addition the result turns out to be also