All pastes #936803 Raw Edit

Jemand

public text v1 · immutable
·published 2008-03-10 17:43 UTC
rendered paste body
 /*Written by Stefan Hirschmann, published dual under GPL and GFDL */
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
 #include <time.h>
 double facult(int n) {
   int i;
   double nf=1;
   for (i=2;i<=n;i++)
       nf*=i;
   return nf;
 }
 int main(int argc, char** argv) {
   clock_t prgstart, prgende;
   const int N=1000000;
   double array[N];
   int i,k,n=60;
   double x,c=1.25;
   double logx, stepValue=1.0;
   prgstart=clock();
   printf("%f",x);
   for (k=0;k<N;k++) {
       array[k]=0;
       x=k/1000.;
       logx = log(x);
       for (i=0;i<=n;i++) {
            // stepValue=pow(c*logx,i)/facult(i);
            stepValue *= c * logx / i;
            array[k]+= stepValue;
       }
   }
   prgende=clock();
   printf ("Die Programmlaufzeit betrug: %.2f Sekunden\n", (float)(prgende-prgstart)/CLOCKS_PER_SEC);
   return EXIT_SUCCESS;
 }