Quoted from colt1954
Quoted from Kenneth_Smith Colt1954,
You appear to be multiplying a single precision complex by a double precision real. Are you using 32 bit or 64 bit compiler? Reason for the question will be apparent in the following note to the folks at Silverfrost.
Paul,
Testing this, I found that multiplying a single precision complex by the double precision real produces incorrect results, for WIN32 (X64 is OK).
A simple example demonstrating the incorrect results is below. Mathematically the correct return value is 2.00 + j 2.00, but the return value with this code incorrect for Win32.
integer, parameter :: dp = kind(1.d0), sp = kind(1.0) complex(kind=sp) a, z real(kind= dp) b a = cmplx(1.0,1.0) b = 2.0 z = a*b print*, 'a ', a print*, 'b ', b print*, 'a*b', z endMultiplying a double precision complex by the single precision real produces the correct results.
The correct results are also obtained when the real and the complex number have the same precision (or kind number).
Rather perplexing. This looks like a compiler bug to me.
Ken
Ken this looks promising will check it out tomorrow how do I check 32 versus 64 bit compiler etc Also will Implicit none have any effect I since it appears in subroutines where VEC array gets used...?
Hi Ken,
Had a look at you last post, if I changed the VEC array to double precision in the first dummy programme (that originally worked) it still worked even though GENG array was just complex (single precision i assume). Just need to change programme VEC array to SP and check that solves the zero array issue??