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 handle ``denormalized'' inputs or results (consider them to be zero).
The directory ~cs611/public/prog2 contains a stub for DoubleAdd, as well as a Makefile and a main routine. This main routine performs a fairly exhaustive test of DoubleAdd.
Your program will be graded primarily by testing it for correct functionality:
However, remember, you may lose points if your program is not properly structured or adequately documented.
Only the distributed test cases will be used for grading this assignment.
Your programs will be graded using an Alpha machine so be sure to test in that environment.
Put your source code in a single file: prog2.c.
Your programs should be submitted for grading from a UNH
CIS Alpha machine (e.g. alberti.unh.edu).
To turn in this assignment, type:
~cs611/bin/submit prog2 prog2.c
Note:
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 19. 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.
Comments and questions should be directed to pjh@cs.unh.edu