Darksonn

limit.c

Nov 30th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. #define ITERATIONS 10000000
  5.  
  6. double eval(double x, double res) {
  7.   unsigned i;
  8.   for (i = ITERATIONS; i > 1; i--) {
  9.     res = pow(x - res, 1.0 / i);
  10.   }
  11.   return res;
  12. }
  13.  
  14. int main(int argc, char **argv) {
  15.   double x, res;
  16.   sscanf(argv[1], "%lf", &res);
  17.   sscanf(argv[2], "%lf", &x);
  18.   res = eval(x, res);
  19.   printf("%.14lf\n", res);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment