CS 208: Computer Organization and Architecture

Problems: floating point numbers, fast adders, and byte order

You may work with your classmates on these problems. If you work closely with another person, feel free to submit your work jointly. (Please, don't submit work from more than two people.)

  1. Do problems 3.14, 15, 22, 23, 24 on pages 238-239 of Patterson and Hennessy, 5th edition.
  2. The following questions concern IEEE 754 32-bit floating point numbers. When I refer to a "representable number," I mean a number whose exact value is one of the values that has a 32-bit IEEE 754 representation.
    • What is the smallest positive integer that is not representable?
    • What is the largest representable positive integer?
    • What is the smallest positive normalized number?
    • What is the largest positive denormalized number?
    • In one of the textbook's earlier editions, there is a paragraph describing a pre-IEEE 754 floating point processor that lacked a guard bit. The paragraph describes a common trick used by programmers that involved writing "(0.5 - x) + 0.5" instead of "1.0 - x" in FORTRAN or C programs to "compensate for the lack of a guard digit." Explain in detail why the lack of a guard digit makes the sensible "1.0 - x" fail while "(0.5 - x) + 0.5" succeeds.
  3. Suppose I store a letter to my sister in a file called letter.txt, and the letter begins "Dear Jody". Now suppose I write a Java program that (1) opens letter.txt, (2) reads the first four bytes into an int variable k, and (3) prints k like so: System.out.println(k);. If I am using a computer with an Intel Core i7 processor (little-endian), what output does this program produce? If I am using a computer with a Motorola G5 processor (big-endian), what output does the program produce?