From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,a40d30986d3f00d7,start X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-11-07 15:50:19 PST Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!library.ucla.edu!ucsbuxb.ucsb.edu!nntp.ucsb.edu!charm.physics.ucsb.edu!def From: def@charm.physics.ucsb.edu (David E. Flynt) Newsgroups: comp.unix.osf.osf1 Subject: ******** Date: 7 Nov 1994 20:02:12 GMT Organization: UCSB Physics Department Distribution: world Message-ID: <39m144$dpc@yuggoth.ucsb.edu> Reply-To: def@charm.physics.ucsb.edu (David E. Flynt) NNTP-Posting-Host: charm.physics.ucsb.edu The following piece of code yields bad (wrong sign) output for dcosd() and cosd() on any Alpha/AXP running 0SF1 v2.0, but gives the correct output when run on any DECstation. The problem depends on the source file or how the file is compiled. For instance, the problem goes away on the Alpha when using the "-g" flag with f77. The problem also goes away when I try to reduce the program by eliminating unrelated source lines (see test.for). Can anybody explain this? ---------------------------cplbug.for----------------------------------------- program gar c c crg 941014 c IMPLICIT REAL*8 (A-H,O-Z) c parameter (np=18) c dimension part(2,np) c c Now begin fits c nobs=1 alpha1=3.5 delta1=81.3 c c ipar=3 call motion(alpha1,delta1, & part(1,ipar),part(2,ipar)) c end subroutine motion(alpha,delta,apart,dpart) c implicit real *8 (a-h,o-z) c pi = 4.d0*datan(1.d0) twopi=2.*pi pio2 = pi/2. pio180=pi/180. c sx = dcosd(delta) sy = dsind(alpha) * dcosd(delta) cq type *,' sx ',sx cq type *,' sy ',sy sz= dsind(delta) c c zx=dcos(delta*pio180) write(*,1077)sx,zx,delta 1077 format(' sx zx delta ',4f12.5) c sx2=sx sy2=sy sz2=sz c thetar= datan2( dsqrt(sx2*sx2+sy2*sy2) , sz2 ) phir = datan2( sy2,sx2 ) c tg = 0.5 pg = -1. c px = 1. *(dcos(thetar)*dcos(phir)*tg) -(dsin(phir)*pg) py = 1. *(dcos(thetar)*dsin(phir)*tg) +(dcos(phir)*pg) pz =-1. *dsin(thetar) *tg c px2=px py2=py pz2=pz c apart = -dsind(alpha)*px2 + dcosd(alpha)*py2 dpart = 0. return end -----------------------------end cplbug.for----------------------------------- --------------------------------test.for--------------------------------------- program test IMPLICIT REAL*8 (A-H,O-Z) c alpha1=3.5 delta1=81.3 c pi = 4.d0*datan(1.d0) twopi=2.*pi pio2 = pi/2. pio180=pi/180. c sx = dcosd(delta1) zx=dcos(delta1*pio180) write(*,1077)sx,zx,delta1 1077 format(' sx zx d ',4f12.5) c c end -------------------------------end bug.for------------------------------------ -------- David E. Flynt UCSB -- David E. Flynt ucsb