Home | History | Annotate | Download | only in test
      1 
      2 #include <stdio.h>
      3 #include <stdlib.h>
      4 #include <math.h>
      5 
      6 int main ( void )
      7 {
      8    int i, j;
      9    double s, r;
     10    s = 0.0;
     11    double* a1 = malloc(1000 * sizeof(double));
     12    double* a2 = malloc(1000 * sizeof(double));
     13    for (i = 0; i < 1000; i++) {
     14      a1[i] = s;
     15      s += 0.3374893482232;
     16      a2[i] = s;
     17    }
     18 
     19    s = 0.0;
     20    r = 0.0;
     21    for (j = 0; j < 5000; j++) {
     22       for (i = 0; i < 1000; i++) {
     23          s += (a1[i] - a2[i]) * (a1[i] + a2[i]) - sqrt(r + 1.0);
     24          r += 0.001;
     25       }
     26    }
     27    printf("s = %f, r = %f\n", s, r );
     28    return 0;
     29 }
     30