stason.org logo lotus


previous page: 29 analysis/cache.p page up: Puzzles FAQnext page: 31 analysis/cats.and.rats.p

30 analysis/calculate.pi.p

 Books
 TULARC
















Description

This article is from the Puzzles FAQ, by Chris Cole chris@questrel.questrel.com and Matthew Daly mwdaly@pobox.com with numerous contributions by others.

30 analysis/calculate.pi.p

How can I calculate many digits of pi?

analysis/calculate.pi.s

long a=10000,
    b,
    c=2800,
    d,e,
    f[2801],
    g;
 
main()
   {
    for (;b-c;) f[b++]=a/5;
 
    for (;
	d=0,g=c*2;
	c-=14, printf("%.4d",e+d/a), e=d%a)
 
    for (b=c;
	 d+=f[b]*a,f[b]=d%--g,d/=g--,--b;
	 d*=b);
   }

 

Continue to:


Share and Enjoy

Bookmark this story so others can enjoy it:
  • digg
  • Reddit
  • del.icio.us
  • Furl
  • Wists

Tags

smart, self-help, motivation, puzzles







TOP
previous page: 29 analysis/cache.p page up: Puzzles FAQnext page: 31 analysis/cats.and.rats.p