home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / microcrn / issue_40.arc / C-REVIEW.ARC / CRUNCH.C < prev    next >
C/C++ Source or Header  |  1987-09-23  |  622b  |  29 lines

  1. /*
  2.      Program: Crunch
  3.      Version: 1.00
  4.      Date:    September 10, 1987
  5.  
  6.      Tests the number crunching capabilities of a C Compiler.
  7. */
  8. #include <stdio.h>
  9. #include <math.h>
  10.  
  11. main()
  12.      {
  13.      double a, b, c, r1, r2, x;
  14.  
  15.      x = 1000.0;
  16.  
  17.      for (a = 0.01; a < 1; a = a + 0.01)
  18.           {
  19.           r1 = tan(exp(log(1.0/a)));
  20.           r2 = sqrt(fabs(r1)) * cos(1/r1);
  21.           b = r1 * r2 + 1.0 / a;
  22.           c = b * a / (r1 - r2);
  23.           x = x * (sqrt(fabs(b))) / (sqrt(fabs(b)));
  24.           x = ((x + c - r1) / r2) * r2 - c + r1;
  25.           }
  26.  
  27.      printf("x = %lf\n",x);
  28.      }
  29.