CS520
Spring 2014
Programming Assignment 2
Due Thursday February 20


Write a C function, FloatAdd, to emulate IEEE 32-bit (single-precision) 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 return value should be the result of performing the IEEE addition algorithm on the two inputs. The floating point addition should be implemented using only integer operations.

Be sure to handle NaN, infinity and denormalized inputs and results.

Your solution for this assignment should run on agate.cs.unh.edu. This machine uses the Intel implementation of IEEE floating point. Your implementation should match the Intel hardware exactly.

The directory ~cs520/public/prog2 contains a stub for FloatAdd.

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

These items are listed in the order that you should tackle them. For example, the testing of rounding will assume that you have implemented the handling of negative inputs.

In addition, remember, you may lose points if your program is not properly structured or adequately documented. See the mandatory guidelines given in the course overview webpage.

Your programs will be graded using agate.cs.unh.edu so be sure to test in that environment.

You should submit all the source code for your implementation of the FloatAdd routine in a single file called FloatAdd.c.

You must turn-off any debugging code before you submit your program.

Your submitted file will be compiled using the following:
gcc -c -g -Wall -std=c99 FloatAdd.c

Note: you are only submitting the one file, FloatAdd.c, so do not put any of your code in any other file. In particular, FloatAdd.c should not include any files that you created. It should only include standard system header files.

Your programs should be submitted for grading from agate.cs.unh.edu. To turn in this assignment, type:
~cs520/bin/submit prog2 FloatAdd.c

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

This assignment is due Thursday February 20. The standard late policy concerning late submissions will be in effect. See the course overview webpage.

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


Last modified on February 1, 2014.

Comments and questions should be directed to hatcher@unh.edu