//Bo Zhang //Homwork 9 //CORDIC #include "header.h" int main(void) { clock_t start, stop; float BaseTen; printf("Value\t\tCORDIC\t\tMaclaurin\tC-Librabry\n"); //formats the top of the output file start = clock(); //starts clock while(scanf("%f",&BaseTen)>0) //scans from file until EOF is reached { if(FloatToBin(BaseTen)>0) //calls the function of convert the Base Ten number to a binary number and checks to see that the scanned number is between 0 and 1 { printf("%f\t%lf\t%lf\t%lf\n",BaseTen,cordic(),MSin(BaseTen),sin(BaseTen)); //prints the 3 sin values by calling the cordic function, the MSin function, and using the C library } } stop=clock(); printf("\nElapsed time = %g Seconds\n", (stop-start)/((float) CLOCKS_PER_SEC)); return 0; }