/* Test code for floating point parsing You will want to test more numbers - this is by no means exhaustive Originally taken from Project 2 Spring 2007. Most recently modified for Homework 5, Summer 2010. File Version: 0.02 */ #include #include // The prototype for sprint_float, as well as the format_t type #include "fp.h" int main() { char buf[256]; uint64_t input; // Ensure clean printing until your sprint_float function is complete buf[0] = '\0'; //hex input = 0xfff0; sprint_float(buf,input,5,10); printf("%s should be: -NaN\n",buf); input = 0x6; sprint_float(buf,input,2,1); printf("%s should be: infinity\n",buf); input = 0x0000000100000000; sprint_float(buf,input,30,33); printf("%s should be: denorm\n",buf); input = 0x33; //0b110011 sprint_float(buf,input,3,2); printf("%s should be: -11.1\n",buf); input = 0x34554340; sprint_float(buf,input,8,23); printf("%s should be: 1.10101010100001101E-10111\n",buf); input = 0x76a; //0b11101101010 sprint_float(buf,input,4,6); printf("%s should be: -1101010.0\n",buf); /*Add testing code for can_represent*/ return 0; }