Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* FORTRAN complex*16 exponentiation bug on alphas
@ 1994-10-11  6:57 Paul Cally
  1994-10-11 15:12 ` Steve Lionel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Paul Cally @ 1994-10-11  6:57 UTC (permalink / 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                           |                                     |
+--------------------------------------------------------------------------+


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1994-10-15 14:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-10-11  6:57 FORTRAN complex*16 exponentiation bug on alphas Paul Cally
1994-10-11 15:12 ` Steve Lionel
1994-10-12 19:27 ` dave.newbold
1994-10-15 14:59 ` Henk Mos

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