Write a function, DoubleAdd, to emulate IEEE 64-bit (double-precision) floating point addition. The routine should take two 64-bit integers as arguments and should return a 64-bit integer. However, the 64-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 fully handle ``denormalized'' inputs or results. Consider denormalized values to be zero.
Your solution for this assignment should run on a CIS Linux machine. In this environment use "long long" to declare a 64-bit integer.
The directory ~cs611/public/prog2 contains a stub for DoubleAdd, as well as a Makefile and a main routine. This main routine performs only a few simple tests of DoubleAdd. You will need to devise additional tests.
Your program will be graded primarily by testing it for correct functionality:
You should include all the tests you tried into an expanded main routine that you submit for grading along with your source code for your implementation of the DoubleAdd routine. Each test and its explicit purpose should be documented with comments included in the main routine. Your grade for each piece of functionality listed above will depend on both the correctness of your implementation and how well you tested it.
In addition, remember, you may lose points if your program is not properly structured or adequately documented.
Your programs will be graded using an CIS Linux machine (e.g. turing.unh.edu) so be sure to test in that environment.
You should submit all the source code for your implementation of the DoubleAdd routine, the expanded main routine, and a Makefile that will build the program. The Makefile you submit might be the same as the Makefile in ~cs611/public/prog2. However, if you change filenames, or add files, you will need to submit an edited Makefile.
Your programs should be submitted for grading from a UNH
CIS Linux machine (e.g. turing.unh.edu).
To turn in this assignment, type:
~cs611/bin/submit prog2 <list of files to submit>
Please submit only your C source files and your Makefile. Do not turn in any other files!
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 September 27. Programming assignments may be handed in late at a penalty of 2 points for one day late, 5 points for two days late, 10 points for three days late, 20 points for four days late, and 40 points for five days late. No program may be turned in more than 5 days late.
Remember: as always you are expected to do your own work on this assignment.
Comments and questions should be directed to hatcher@unh.edu