[net.math] More bragging about excessive accuracy.

greg@mcc-db.UUCP (Greg) (08/04/85)

e to 40,000 places in an hour and a half on a Vax 750:
(Not entirely optimized, either)

#define NUM1 11100
#define NUM2 10000
#define BASE 10000
#include <stdio.h>

main()
{
    register int j,c;
    int i,a[NUM1];
    printf("2.");
    for(i=2;i<NUM1;i++)a[i]=1;
    for(i=0;i<NUM2;i++)
    {
	c=0;
	for(j=NUM1-1;j>1;j--)
	{
	    a[j]=(c=a[j]*BASE+c)%j;
	    c=c/j;
	}
	putchar(c/1000 + 48);
	putchar((c/100)%10 + 48);
	putchar((c/10)%10 + 48);
	putchar(c%10 + 48);
	if(!(i%18))
	    printf("\n");
     }
     printf("\n");
}
-- 
gregregreg