HW: Interpreting Binary Data

Part A: Signed and Unsigned Integers


Complete the following exercises:

  1. 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 pts total).
  2. 1a Hex Binary
    0x46 0100 0110
    + 0x74 0111 0100
    1b Hex Binary
    + 0xE9
    1c Hex Binary
    + 0x74
    1d Hex Binary
    + 0xE9
  3. For the 4 numbers that appear as operands above (0x46, 0x74, 0x87, 0xE9):      4 pts each (8 pts total)
  4. 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? 4 pts
  5. 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?
    6 pts
  6. 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.)
    2 pts
  7. 1b as sub  Binary Hex
    binary for 0x46 0x46
    binary for - (-0xE9) - 0x17

Part B: Floating Point Numbers

  1. What is the floating point decimal value for 0xC1740000 if it represents a 32-bit floating point number?      3 pts
  2. What is the binary 32-bit floating point representation for -1609.5?      3 pts
  3. What is the 64-bit floating point representation for the same number (-1609.5)?      2 pts