* 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* Re: FORTRAN complex*16 exponentiation bug on alphas
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
2 siblings, 0 replies; 4+ messages in thread
From: Steve Lionel @ 1994-10-11 15:12 UTC (permalink / raw)
In article <37dd1a$224@harbinger.cc.monash.edu.au>,
cally@zeus.maths.monash.edu.au (Paul Cally) writes:
|>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:-
[snip]
This problem appears to have been corrected in DEC OSF/1 AXP V3.0, which
is the current version. I believe it is a math library problem and would
be unaffected by the compiler version, since the math library ships as
part of DEC OSF/1 AXP.
--
Steve Lionel Mail: lionel@quark.enet.dec.com
DEC Fortran Development WWW: http://www.digital.com/info/slionel.html
Digital Equipment Corporation
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698 "Free advice is worth every cent"
For a summary of Digital's Internet services, send mail to info@digital.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FORTRAN complex*16 exponentiation bug on alphas
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
2 siblings, 0 replies; 4+ messages in thread
From: dave.newbold @ 1994-10-12 19:27 UTC (permalink / raw)
Hi,
This is a fairly well-known bug in some releases of Fortran. Fixed in the latest
version, I think. DEC also do a patch for earlier versions.
BTW, I _think_ this only occurs if you optimise... you could always compile
affected modules -O0.
_Dave_
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FORTRAN complex*16 exponentiation bug on alphas
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
2 siblings, 0 replies; 4+ messages in thread
From: Henk Mos @ 1994-10-15 14:59 UTC (permalink / raw)
In <37dd1a$224@harbinger.cc.monash.edu.au> cally@zeus.maths.monash.edu.au (Paul Cally) writes:
>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:-
[deleted]
>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?
I'm running DFABASE341 with DFARTL352 under OSF/1 2.1 and
^
your example gave no strange results (with -O4).
So I don't think you have to upgrade to 3.0. Just install the latest
version of Fortran.
/Henk
--
----------------------------------------------------------------------
Henk J. Mos, Dept of Physics and Astrophysics, Utrecht University
The Netherlands. Phone: 31-30-532239 Email: mos@fys.ruu.nl
----------------------------------------------------------------------
^ 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