home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math
- Path: sparky!uunet!mcsun!sunic!kth.se!vana!TORDM
- From: tordm@vana (Tord G.M. Malmgren)
- Subject: Re: Calculating pi: help!
- Message-ID: <1992Oct14.112018.19335@kth.se>
- Sender: usenet@kth.se (Usenet)
- Nntp-Posting-Host: vana.physto.se
- Reply-To: TordM@VanA.PhySto.SE
- Organization: Department of Physics, University of Stockholm -- Sweden
- References: <Bw304E.LKu@mentor.cc.purdue.edu>,<7557@charon.cwi.nl>
- Date: Wed, 14 Oct 1992 11:20:18 GMT
- Lines: 28
-
- In article <7557@charon.cwi.nl>, dik@cwi.nl (Dik T. Winter) writes:
-
- [...]
- >But below you will find a short C program that will give you
- >pi to 800 digits:
- >int 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);}
- >It takes less than a second on a high-end work-station.
-
- very cryptic and somewhat fast, but it yields a somewhat faulty results
- Pi:
- 3141592653589793238462643383279502884197169399375105820974944592307816406286208
- 9986280348253421170679821480865132823066470938446095505822317253594081284811174
- 5028410270193852110555964462294895493038196442881097566593344612847564823378678
- The above routine:
- 31415926535897932384626433832795 2884197169399375105820974944592307816406286208
- 9986280348253421170679821480865132823 66470938446 955 5822317253594081284811174
- 502841 27019385211 555964462294895493038196442881097566593344612847564823378678
- where the empty spaces marks where your routine misses a digit -- format err?
-
-
-
-
- ---------------+--------------------------------
- Tord Malmgren | InterNet: TordM@VanA.PhySto.SE | These opinions are my OWN,
- | BITNet : TordM@SESUF51 | and NOT of this department!
- ---------------+--------------------------------
- Department of Physics, University of Stockholm
-