Category : Miscellaneous Language Source Code
Archive   : CODEVIEW.ZIP
Filename : PI.C

 
Output of file : PI.C contained in archive : CODEVIEW.ZIP
#define MAXPRC 4000

char p[MAXPRC];
char t[MAXPRC];
int q;

main(argc,argv)
int argc;
char *argv[];
{
long startime, endtime;
register int i;

if (argc == 2) {
sscanf(argv[1],"%d",&q);
} else {
printf("Usage: pi [precision]\n");
exit(55);
}

if (q > MAXPRC) {
printf("Precision too large\n");
exit(66);
}

/* compute pi */

time(&startime);
arctan(2);
arctan(3);
mul4();
time(&endtime);

/* print pi */

printf("pi = %d.",p[0]);
for (i = 1; i <= q; i++)
printf("%d",p[i]);
printf("\n");
printf("%ld seconds to compute %d digits of pi\n",endtime-startime,q);
}


  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : CODEVIEW.ZIP
Filename : PI.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/