/* * taylor.c * * This program calculates the value of e*pi by first calculating e * and pi by their taylor expansions and then multiplying them * together. */ #include #include #define num_steps 20000000 int main(int argc, char *argv[]) { double start, stop; /* times of beginning and end of procedure */ double e, pi, factorial, product; int i; /* start the timer */ start = clock(); /* First we calculate e from its taylor expansion */ printf("e started\n"); e = 1; factorial = 1; /* rather than recalculating the factorial from scratch each iteration we keep it in this varialbe and multiply it by i each iteration. */ for (i = 1; i