Assignment 10, due Apr 11

Part of the homework for 22C:60 (CS:2630), Spring 2014
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!

  1. Background: Consider this floating point format:
      _______________
     |_|_______|_____|
     | | | | | | | | |
     |s|   e   |  m  |
    

    There are no hidden bits here, and no special cases for e = 0000 or e = 1111.

    a) What is the exact decimal representation of the largest positive number in this floating point system? (0.3 points)

    b) What is the exact decimal representation of the most extreme negative number in this floating point system? (0.1 points)

    c) What is the exact decimal representation of the smallest nonzero positive number in this floating point system? (0.3 points)

  2. Background: Now, consider what you gain by adding an IEEE-style hidden bit to this floating point number system:

    Note that we did not move the point when we added the hidden bit, so the hidden bit is in the one's place of the mantissa.

    a) What is the exact decimal representation of the largest non-infinite positive number in this floating point system? (0.3 points)

    b) What is the exact decimal representation of the most extreme non-infinite negative number in this floating point system? (0.1 points)

    c) What is the exact decimal representation of the smallest nonzero positive number in this floating point system? (0.3 points)

    c) What is the binary representation of 1.0 in this floating point system. (0.3 points)

  3. Background: Consider the problem of computing the distance between two points in the plane -- given that R3 points to one point and R4 points to another point, where each point is represented as 2 consecutive words in memory, where the words of each point represent the x and y coordinates of that point.

    A problem: Write Hawk code to compute the distance, leaving the result in FPA0. Assume the floating point coprocessor is already turned on in single-precision mode. (1.0 point)

    A small problem: Look at the code near the start of Chapter 12 for the GETCHAR routine. This uses the BITTST and BBR macros. What are the actual machine instructions this uses. You can solve this problem using the manual, but it might be faster to just assemble the code and look at how the Hawk emulator disassembles it. (0.3 points)