From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,ab524efb975fa3dc,start X-Google-Attributes: gid1164f8,public X-Google-Thread: 10b612,ab524efb975fa3dc,start X-Google-Attributes: gid10b612,public X-Google-ArrivalTime: 1994-04-26 18:52:28 PST Xref: gmd.de comp.sys.dec:15124 comp.unix.ultrix:13864 Path: gmd.de!nntp.gmd.de!xlink.net!howland.reston.ans.net!cs.utexas.edu!swrinde!ihnp4.ucsd.edu!galaxy.ucr.edu!library.ucla.edu!europa.eng.gtefsd.com!MathWorks.Com!news.kei.com!uhog.mit.edu!wupost!news.miami.edu!not-for-mail From: jim@lime.rsmas.miami.edu (Jim Brown) Newsgroups: comp.sys.dec,comp.unix.ultrix Subject: WARNING: Severe error in sincos RTL primative (OSF/1 v2.0+) Followup-To: comp.sys.dec Date: 26 Apr 1994 16:42:08 -0400 Organization: R.S.M.A.S. Distribution: na Message-ID: <2pjub0$q25@lime.rsmas.miami.edu> NNTP-Posting-Host: lime.rsmas.miami.edu Summary: f77 -O2 and above uses sincos primative and loses Keywords: sincos The following short FORTRAN program (if compiled -O or -O2/better) demonstrates a SEVERE bug in the OSF/1 runtime library (libm) used by FORTRAN. [Optimization levels O2 and above collapse occurrences of the SIN and COS of the same argument into one RTL call to the routine "sincos(x)" which returns both values.] program a real*8 x, y, z real*8 colat, lon, lat lat = -75d0 colat = 90d0-lat do lon=-169d0,-172d0,-1d0 x = dcosd(LON)*dsind(COLAT) y = dsind(LON)*dsind(COLAT) print *,sngl(lat),sngl(lon),sngl(x),sngl(y) end do end Example of bad results (seen on both OSF/1 v1.3, rev 111 and OSF/1 v2.0, rev 240 (and 'FT after v2.0', rev 248.1) using either f77 t3.4 or f77 v3.4): LAT LON X Y -75.00000 -169.0000 -0.2540638 -4.9385004E-02 -75.00000 -170.0000 -0.2548870 -4.4943456E-02 -75.00000 -171.0000 0.2556325 -4.0488217E-02 -75.00000 -172.0000 0.2563002 -3.6020648E-02 Notice that X loses its '-' sign. A similar result obtains for LON between +169 and +172. This bug has been reported to DEC (FT QARs 21221/21222). Jim Brown, U Miami, jim@lime.rsmas.miami.edu -- Jim Brown, University of Miami, RSMAS/MPO [send mail to jim@lime.rsmas.miami.edu]