James Giles sent the indented text:
>
> W. J. Metzger <[log in to unmask]> wrote:
> ...
> >How about sumx = sum( real( x, kind(0d0) ) )
>
> Or (possibly better):
>
> sumx = sum( real(x, kind(sumx) ) )
>
> This way you can change to double, quad, or whatever by
> simply redeclaring SUMX. No need to rewrite code fragments.
> Of course, this assumes that kind(sumx) is of greater precision
> than kind(x).
>
> --
> J. Giles
>
>
Or how about:
sumx = sum( real( x, selected_real_kind( &
max(precision(x),precision(sumx)), &
max(range(x),range(sumx)))))
:-)
--
John Jeffrey Venier, B.A., M.Stat. Programmer Analyst III
Section of Computer Science Department of Biomathematics
The University of Texas M. D. Anderson Cancer Center, Houston, Texas
[log in to unmask] +1 713 792 2622
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|