- 0x23 means hexadecimal 23 (= 2 * 16 + 3 = 3510).
- hex A = decimal 10; B = 11; C = 12; D = 13; E = 14; F = 15
- hex A + 3 = decimal 10 + 3 = decimal 13 = hex D
- The range of unsigned integers that can be represented in 8 bits
is 0 ... 255.
- The range of signed two's complement integers that can be
represented in 8 bits is -128 ... 127.
Complete the following exercises:
- Calculate the following sums in hexadecimal and binary. Assume
the numbers represent 8-bit unsigned integers. Circle
or highlight any result
that has an overflow. Note whether the hex and binary sums
represent the same number.
1 pt for each hex value; 1 pt for each binary value; 1 pt for
identifying whether or not there was an overflow for each sum (12
For the 4 numbers that appear as operands above (0x46, 0x74, 0x87, 0xE9):
4 pts each (8 pts total)
- Look at the binary representations and determine which represent
different numbers when considered as 8-bit two's complement signed
integers rather than unsigned integers? (How can you recognize them?)
- For each of the numbers whose value is different when
considered as unsigned vs. 2's complement, calculate both
- Which of the calculations in Question #1 above have operands or sums whose values
depend on whether they represent unsigned or 2's complement numbers?
(Question #2 provides part, although not all, of the answer to this question.)
Would you expect the results of the sums to be different if the
numbers were treated as 2's complement?
- For all of the sums above that would be different if calculated or interpreted
as 2's complement signed integers, re-calculate or re-interpret
assuming that notation.
When does overflow occur? Is this the same as in problem (1) above?
Why or why not?
- Recalculate 1b (0x46+0xE9) using subtraction, treating 0x46 and 0xE9 as 2's
complement binary integers. In other words, calculate 0x46 - (-0xE9), in
binary. Then do the same calculation in hex. Both answers should match
your answer in 1b. (Tip: -0xE9 = 0x17. Verify this by comparing
it to the binary 2's complement value you calculated.)
|1b as sub
|binary for 0x46||
|binary for - (-0xE9)||
- What is the floating point decimal value for 0xC1740000 if it
represents a 32-bit floating point number?
- What is the binary 32-bit floating point representation for
- What is the 64-bit floating point representation for the same