Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: cally@zeus.maths.monash.edu.au (Paul Cally)
Subject: FORTRAN complex*16 exponentiation bug on alphas
Date: 11 Oct 1994 06:57:46 GMT	[thread overview]
Message-ID: <37dd1a$224@harbinger.cc.monash.edu.au> (raw)

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                           |                                     |
+--------------------------------------------------------------------------+


             reply	other threads:[~1994-10-11  6:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-11  6:57 Paul Cally [this message]
1994-10-11 15:12 ` FORTRAN complex*16 exponentiation bug on alphas Steve Lionel
1994-10-12 19:27 ` dave.newbold
1994-10-15 14:59 ` Henk Mos
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox