CS611
Programming Assignment 2
Spring 1997


Write a function, FloatAdd, to emulate IEEE 32-bit floating point addition. The routine should take two 32-bit integers as arguments and should return a 32-bit integer. However, the 32-bit integers should be interpreted to be actually floating point values. The floating point addition should be implemented using only integer operations. The return value should be the same as what is produced by the IEEE floating point hardware when given the same inputs. Be sure to handle NaN and Infinity inputs and results. However, you do not need to handle ``denormalized'' inputs or results (consider them to be zero).

The directory ~cs611/public/progs/prog2 contains a stub for FloatAdd, as well as a Makefile and a main routine. To test, you can modify this main routine. A fairly exhaustive test is also being distributed (main.c-HARD). To use this test simply rename it as main.c and re-make.

Your program will be graded primarily by testing it for correct functionality:

However, you may lose points if your program is not properly structured or adequately documented. The following are some guidelines:

Only the distributed test cases will be used for grading this assignment.

You can write your program in either C or C++. If you use C++ then edit the distributed Makefile to use the C++ compiler. Your programs will be graded using an Alpha machine (e.g. hopper and christa) so be sure to test in that environment.

Your programs should be submitted for grading from either hopper or christa. To turn in this assignment, type:
~cs611/bin/submit prog2 FloatAdd.c Makefile

Notes:

Submissions can be checked by typing:
~cs611/bin/scheck prog2

To receive full credit for the assignment, you must turn in your files prior to 8am on Monday February 24. Late submissions will be accepted at the penalty of 5% per day up to one week late.

Remember: as always you are expected to do your own work on this assignment.


Last modified on February 6, 1997.

Comments and questions should be directed to pjh@cs.unh.edu