home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!mcsun!sunic!psinntp!psinntp!dlogics!ejk
- From: ejk@dlogics.com (Edward Kaszubowski)
- Subject: Re: POWER OF LARGE NUMBERS
- Organization: Datalogics, Inc.
- Date: Thu, 20 Aug 92 18:06:38 GMT
- Message-ID: <1992Aug20.180638.19180@dlogics.com>
- References: <1992Aug12.135106.12924@cs.uow.edu.au> <thompson.713734408@daphne.socsci.umn.edu> <1992Aug16.052157.1991@organpipe.uug.arizona.edu> <1992Aug17.222948.10070@merlin.dev.cdx.mot.com> <CGAY.92Aug17223208@majestix.cs.uoregon.edu> <1992Aug19.142921.27592@crpmks.uucp>
- Lines: 25
-
- billb@crpmks.uucp (Bill Bochnik (Info Systems)) writes:
-
- >Just for amusement, what was the repeating formula for calculating PI to any
- >desired number of digits? Thanks.
-
- the series 4 4 4 4 4 4
- - - - + - - - + - - - + ..... will give you pi.
- 1 3 5 7 9 11
-
- However, I do know that this is a slow algorithm, there are others that
- are much more efficient. (and more complicated)
-
- code:
- pi = 0
- for loop = 1 to infinity step by 2
- if (loop + 1) is divisible by 4
- pi = pi - 4/loop
- otherwise
- pi = pi + 4/loop
-
- --
-
- ---------------------------------------------------------
- | Edward J. Kaszubowski ejk@dlogics.dlogics.com |
- | Systems Engineer II Datalogics Inc. |
-