home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 5.ddi / MWHC.005 / V < prev    next >
Encoding:
Text File  |  1992-03-30  |  669 b   |  27 lines

  1. /*
  2. ** savage.c -- floating point speed and accuracy test.  C version
  3. ** derived from BASIC version which appeared in Dr. Dobb's Journal,
  4. ** Sep. 1983, pp. 120-122.
  5. */
  6.  
  7. #define ILOOP  25000
  8.  
  9. extern  double  tan(), atan(), exp(), log(), sqrt();
  10.  
  11. #include <system.cf>    /* MetaWare-specific timing routines. */
  12.  
  13. main()
  14. {
  15. int i;
  16. double a;
  17.  
  18.         printf("start\n");
  19.         long starttime = clock();
  20.         a = 1.0;
  21.         for (i = 1; i <= (ILOOP - 1); i++)
  22.                 a = tan(atan(exp(log(sqrt(a*a))))) + 1.0;
  23.         printf("%ld 100ths of a second\n",clock()-starttime);
  24.         printf("a = %20.14e\n", a);
  25.         printf("done\n");
  26. }
  27.