Article View: sci.math.num-analysis
Article #498Re: Computing PI:
From: Wayne Lui
Date: Fri, 11 Sep 1992 03:54
Date: Fri, 11 Sep 1992 03:54
28 lines
1062 bytes
1062 bytes
In article <1708@sousa.ltn.dec.com> perkins@sousa.ltn.dec.com (Eric Perkins)
writes:
>There was an article posted a while back asking for an infinite
>PI program. Did anyone have such a program ?
Here goes:
program pi
implicit double precision (a-h,o-z)
c
a=1.d0
b=1.d0/dsqrt(2.d0)
t=.25d0
x=1.d0
c
do 10 i=1,10
y=a
a=.5d0*(a+b)
b=dsqrt(b*y)
t=t-x*(y-a)*(y-a)
x=2.d0*x
p0=p1
p1=.25d0*(a+b)*(a+b)/t
write(6,*)i,p1
10 continue
c
stop
end
Technical Details
Message-ID:
<4381@nttica.ntt.JP>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!ames!sun-barr!sh.wide!wnoc-tyo-news!ccut!wsclark!lab!nttica!nttioe!wayneluiReferences:
<1708@sousa.ltn.dec.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!ames!sun-barr!sh.wide!wnoc-tyo-news!ccut!wsclark!lab!nttica!nttioe!waynelui From: waynelui@nttioe (Wayne Lui) Newsgroups: sci.math.num-analysis Subject: Re: Computing PI: Message-ID: <4381@nttica.ntt.JP> Date: 11 Sep 92 03:54:48 GMT References: <1708@sousa.ltn.dec.com> Sender: news@nttica.ntt.JP Organization: NTT Opto-electronics Labs., Atsugi, Kanagawa Japan Lines: 28