Practice exercise -- Computer Arithmetic
1. Extend this table to show counting from 0 through 16 in binary (base 2) and
hexadecimal(base 16).
Base
10: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
2:
16:
2. Use positional notation to assist the conversion of the binary number
10010111 to decimal, and the hexadecimal number 1AE to decimal.
3. Convert the decimal number 151 into binary and into hexadecimal. This may
be done by repeated division by the base until the quotient becomes zero.
Here the first dividend is 151. After a divide the remainder becomes the
next digit (to the left) in the result, and the quotient becomes the
dividend.
4. Binary Addition: there are four possibilities: 0 + 0 = 0, 0 + 1 = 1,
1 + 0 = 1, and 1 + 1 = 10 (i.e. 0 with a 1 carry). Add the binary number
for decimal 7 to the binary number for decimal 19.
5. Do subtraction with binary numbers by "addition of the complement".
To find the "two's complement" when representing a binary number,
take a positive binary number, invert the bits and add 1.
Problem: subtract the binary number for decimal 7 from the binary
number for decimal 26.
a. Find the minuend by converting the decimal number 26 to an 8-digit
binary number;
b. convert the decimal 7 to an 8-digit binary number;
c. the subtrahend is the two's complement of the binary number for 7;
d. then, subtract by adding the minuend value to the subtrahend.