home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!usc!sdd.hp.com!caen!batcomputer!ghost.dsi.unimi.it!univ-lyon1.fr!chx400!news.unige.ch!scsun.unige.ch!pfennige
- From: pfennige@scsun.unige.ch (PFENNIGER Daniel)
- Subject: Re: ALGAMA function, optimization question
- Message-ID: <1992Nov13.081750.29014@news.unige.ch>
- Sender: usenet@news.unige.ch
- Organization: University of Geneva, Switzerland
- References: <1992Nov11.043558.12534@wam.umd.edu> <92317.150302HDK@psuvm.psu.edu>
- Date: Fri, 13 Nov 1992 08:17:50 GMT
- Lines: 51
-
- In article <92317.150302HDK@psuvm.psu.edu>, H. D. Knoble <HDK@psuvm.psu.edu>
- sends subroutines about the DGAMMA/DLOGAM functions.
-
- The DLGM function reads:
-
- > DOUBLE PRECISION FUNCTION DLGM(W)
- > C===Companion function for DGAMMA and DLOGAM.
- > DOUBLE PRECISION C(20), W,W2,PRESUM,CONST,DEN,SUM
- > INTEGER I
- > C(1)=1.D0/12.D0
- > C(2)=-1.D0/360.D0
- > C(3)=1.D0/1260.D0
- > C(4)=-1.D0/1680.D0
- > C(5)=1.D0/1188.D0
- > C(6)=-691.D0/360360.D0
- > C(7)=1.D0/156.D0
- > C(8)=-3617.D0/122400.D0
- > C(9)=43867.D0/244188.D0
- > C(10)=-174611.D0/125400.D0
- > C(11)=77683.D0/5796.D0
- > C(12)=-236364091.D0/1506960.D0
- > C(13)=657931.D0/300.D0
- > C(14)=-3392780147.D0/93960.D0
- > C(15)=1723168255201.D0/2492028.D0
- > C(16)=-7709321041217.D0/505920.D0
- > C(17)=1516286977551.D0/396.D0
- > C(18)=-26315271553053477373.D0/2418179400.D0
- > C(19)=1542102059911661.D0/444.D0
- > C(20)=-261082718496449122051.D0/21106800.D0
- > CONST=.91893853320467274178032973640561763986139747363778D0
- > C---CONST=DLOG(SQRT(2*PI))
- > DEN=W
- > W2=W*W
- > PRESUM=(W-.5D0)*DLOG(W)-W+CONST
- > DO 1 I=1,20
- > SUM=PRESUM+C(I)/DEN
- > IF(SUM.EQ.PRESUM) GOTO 2
- > DEN=DEN*W2
- > 1 PRESUM=SUM
- > 2 DLGM=SUM
- > RETURN
- > END
-
- My question to experts in optimization is:
- What is the better way to initialize such an array C of constants
- 1) DATA statement
- 2) PARAMETER statement
- 3) the above example as an optimizing compiler anyway detects that
- C and CONST are constant.
-
- Daniel Pfenniger
-