> integer, parameter :: wp=kind(0.0d0) ! Using selected_real_kind is no
> different complex(kind=wp) :: x, erf
Although this will work in most situations I think that a more
safe way to do this is the following:
integer, parameter :: dp=kind(0.0d0),sp=kind(1.0)
integer, parameter :: wp=kind((1.0_dp,1.0_dp))
complex(kind=wp) :: x, erf
I believe there is no guarantee that the double precision complex has the
same kind value as its real counterpart.
Also a variant of the timing loop earlier could be:
erf_x=0.0 ; x=1.0
CALL SYSTEM_CLOCK(CLOCK=c1)
DO k=1,1000
x=x+1.0E-6
erf_x=erf_x+1E-6*Erf(x)
END DO
CALL SYSTEM_CLOCK(CLOCK=c2)
counts=c2-c1
write(*,*) erf
The extra overhead is one multiply-add and an add which will usually not
even show above the background noise in the measurement. Care must be taken
so that there are no underflows or overflows caused in x or erf_x since
these might cause error in timings due to IEEE floating point interrupts.
/Nils
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|