From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,7ab0bd6311cbc59e,start X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-10-11 00:40:08 PST Path: bga.com!news.sprintlink.net!sunserver.insinc.net!cato.Direct.CA!vanbc.wimsey.com!unixg.ubc.ca!news.mic.ucla.edu!library.ucla.edu!agate!msuinfo!harbinger.cc.monash.edu.au!zeus.maths.monash.edu.au!cally From: cally@zeus.maths.monash.edu.au (Paul Cally) Newsgroups: comp.unix.osf.osf1 Subject: FORTRAN complex*16 exponentiation bug on alphas Date: 11 Oct 1994 06:57:46 GMT Organization: Monash Uni Distribution: world Message-ID: <37dd1a$224@harbinger.cc.monash.edu.au> NNTP-Posting-Host: zeus.maths.monash.edu.au Keywords: FORTRAN, alpha, complex I have found a very nasty bug in the DEC FORTRAN compiler for AXP (alpha) machines. Exponetiation of a complex*16 number gives rubbish. Here is an example in which the square root of (4.d0,0.d0) is calculated in three different ways:- program tst complex*16 s,sr_power,sr_exp,sr_sqrt s = (4.d0,0.d0) sr_power = s**0.5 sr_exp = exp(0.5*cdlog(s)) sr_sqrt = sqrt(s) write(6,1)s,sr_power,sr_exp,sr_sqrt stop 1 format('s =',d14.7,x,d14.7,/, & 's**0.5 =',d14.7,x,d14.7,/, & 'exp(0.5*cdlog(s)) =',d14.7,x,d14.7,/, & 'sqrt(s) =',d14.7,x,d14.7) end -- and here is the output: s = 0.4000000D+01 0.0000000D+00 s**0.5 = 0.1284025D+01 0.0000000D+00 exp(0.5*cdlog(s)) = 0.2000000D+01 0.0000000D+00 sqrt(s) = 0.2000000D+01 0.0000000D+00 As you can see, s**0.5 gets it wildly wrong. The other methods work. The strange thing is that I would have thought that s**0.5 actually worked by evaluating exp(0.5*cdlog(s)). I was running DEC Fortran V3.4 (DFABASE340) with DFARTL342 DEC Fortran for OSF/1 AXP Runtime Support under OSF/1 2.0B on a DEC 3000/800. Is this a known bug? Has it been/is it being fixed? +--------------------------------------------------------------------------+ |Dr. Paul Cally | Ph: +61 (0)3 905-4471 | |Mathematics Department | Fax: +61 (0)3 905-3867 | |Monash University | | |Clayton, Victoria 3168 | cally@zeus.maths.monash.edu.au | |AUSTRALIA | | +--------------------------------------------------------------------------+