### Problem Set Number 2 Computer Science 471 Due by 5 PM, Monday Sept. 30, 1996

1. (5 points) Problem 4.1 from the Patterson & Hennessy text. (Beware: the address-displacement field of loads and stores is a signed, 2's-complement number.)

2. (5 points) Problem 4.20 from the text. Appendix section A.10 may be helpful.

3. (5 points) Problem 4.21 from the text.

4. (10 points) Problem 4.23 from the text.

5. (10 points) Let x = 10010.1101 and y = 00110011.1 and z = -111100.10101 be the representations in base 2 of three numbers. Show exactly how x, y, and z would be represented in the IEEE single-precision floating-point format. Show all the bits, just as they would appear in a MIPS register or memory word.

6. (10 points) Show the steps involved in the single-precision floating-point addition of x and y from question 5. Use binary operations, and show all the partial results along the way. The operands must start out in IEEE format. This question does not ask you to design any hardware, just to show the computational steps, like ``shift significand'' and ``normalize'' and ``round'' and things like that. Assume that the rounding rule is: round to the nearest representable number, and round to the even one if the result is exactly half-way between the two nearest numbers. Show all the bits of the result in IEEE format, just as in question 5.

7. (20 points) The third ``Fallacy'' of section 4.10 of the text tells the sorry story of a now-infamous hardware bug in the Intel Pentium chip. This bug causes a small relative error in certain floating-point calculations. A concise early description of the problem may be found in http://www.cs.princeton.edu/courses/cs471/pentbug.txt. One initial response to this bug was Intel's claim that the particular numbers involved would occur extremely rarely, and that in any case the error was confined to the ``9th digit.'' The Computer Science Department is the proud owner of a Pentium system that has the bug (node2.cs) and another with the bug fixed (ShrimpFS.cs). Both systems run the Linux operating system. A guest account has been set up on them for your use; the login is ``pentium'' and the password you will hear in class.

For this question, please come up with a small computation that goes very very wrong because of this bug. Your computation should solve some plausible physical problem, not just calculate the value of some abstract numerical expression. Please create a personal subdirectory for your experiments (if you work together you can make one for your group). In the test subdirectory you will find a program that will expose the bug.

You can write a short program or use a spreadsheet or a calculator program (just look around). Have your program or your spreadsheet produce some output you can hand in. Also hand in the code, if any. Run it on both systems. Please be good citizens while you use these systems.

The most alarming answers to this question will be mentioned in class.

8. (5 points) Another chapter questionnaire to help the fellas and their publisher improve their book. The chapter 3 (that's 3, not 4) questionnaire may be found at http://www.cs.princeton.edu/courses/cs471/chap3.txt. Please fill it out and e-mail the result to the publisher as directed. Please do not, repeat not, ``cc your instructor on this email,'' as the form directs. To get the 5 points for this question, just write down the time you sent your message to the publisher.

9. (1 point) How long did this take you, not counting the reading, and with whom did you work?