ok, I have edited the code a bit myself now.
PHP Code:
[CODE]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
double pi,a,b,c,x,a1,b1,c1,x1;
float loops,cycles;
/* Well, done no clyles yet. */
cycles = 0;
/* Title */
printf("Pi\nBy Anthony\n");
/* Get the number of loops */
printf("Enter number of loops: ");
scanf("%f", &loops);
/* We are doing something... */
printf("Calculating Pi...\nPlease Wait");
/* Now lets set the first values. */
a = 1;
b = (1/pow(2,0.5));
c = 0.25;
x = 1;
/* And then set last values to that... */
a1 = a;
b1 = b;
c1 = c;
x1 = x;
/* Pi loops, we do it how how many times??? */
while ( cycles < loops ) {
cycles += 1; /* 1 loop started. */
/*start the calculations */
a = ((a1 + b1) / 2);
b = pow((a1 * b1),0.5);
c = c1 - x1 * pow((a - a1),2);
x = (2 * x1);
/* Set a1,b1,c1 and x1 ... */
a1 = a;
b1 = b;
c1 = c;
x1 = x;
/* show progress */
printf("%.0f / %.0f\n",cycles,loops);
}
/* Done, end of loading */
system("cls");
/* Calculate pi */
pi = (pow((a + b),2) / (4 * c));
/* Output */
printf("Done. Pi is %.25f\n",pi);
system("pause");
}
[/CODE]
My question is, how can I get more than 15 decimals places?