home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!comlab.ox.ac.uk!imc
- From: imc@comlab.ox.ac.uk (Ian Collier)
- Newsgroups: comp.programming
- Subject: Re: how to calculate PI
- Message-ID: <2961.imc@uk.ac.ox.prg>
- Date: 25 Jan 93 12:10:14 GMT
- References: <LOWRY.93Jan20104500@rotor.watson.ibm.com> <c8h3xpm@rpi.edu> <1993Jan23.080718.24306@qiclab.scn.rain.com>
- Organization: Oxford University Computing Laboratory
- Lines: 31
- X-Local-Date: Monday, 25th January 1993 at 12:09pm GMT
- Originator: imc@msc3.comlab
-
- In article <1993Jan23.080718.24306@qiclab.scn.rain.com>, Leonard.Erickson@f51.n105.z1.fidonet.org wrote:
- >rogerj@aix.rpi.edu (Diversion (Jeff Rogers)) writes:
- >>lowry@watson.ibm.com (Andy Lowry) writes:
- >>>One of the coolest formulas I've seen in Gregory's formula:
- >>> pi/4 = 4*atan(1/5)-atan(1/239)
-
- (earlier I explained how this formula might have been invented. Now can
- someone give me a convincing explanation for how someone came up with
-
- pi ~= 3*ln(640320)/sqrt(163) [16 decimal places]
-
- mentioned in the October notices of the AMS?)
-
- >>Why not just
- >> pi/4=atan(1)?
-
- >On several different machines I've found that 2*atan(maxreal) gives
- >a more accurate value for pi than 4*atan(1).
-
- This is presumably because a library routine probably calculates atan(x)
- where x>1 by HALFPI - atan(1/x) (where HALFPI is a stored constant),
- whereas it probably calculates atan(1) by using a modified form of the
- Taylor series. In other words, by calculating atan(maxreal) you are fetching
- the pre-computed value of pi/2 whereas in asking for atan(1) you are
- calculating pi/4 as the sum of several terms. Also, since atan(epsilon) is
- approximately equal to epsilon when epsilon is small, the error in the
- result after setting maxreal to 1eN is only 2e-N - which is too small to
- register (e.g.) in any 64-bit-float representation of pi if N is 20 or more.
-
- Ian Collier
- Ian.Collier@prg.ox.ac.uk | imc@ecs.ox.ac.uk
-