Hi,
You misunderstand the issue. The array is single precision,
but the summand is double precision. I need the summation
to be done in double precision. The DO loop does this,
but my concern is that the SUM intrinsic does not, though
ont he surface it appears to.
-P.
On Wed, 20 Sep 2000, Matthijs van Waveren wrote:
> Peter Shenkin wrote:
>
> > It is common to have code like the following, where accumulation
> > is into a DP variable:
> >
> > REAL :: x( 100 )
> > DOUBLE PRECISION :: sumx
> > INTEGER i
> >
> > ...
> >
> > sum = 0
> > DO i = 1, 100
> > sumx = sumx + x( i )
> > END DO
> >
> >
> > One is tempted to preplace the DO loop with the F90 statement:
> >
> > sumx = sum( x )
> >
> > However, AFAIK, the summation will then be done in single precision.
> >
> > Is this correct? If so, I guess I still have to use the
> > DO loop. :-)
>
> No, this is not correct. The specification of the SUM intrinsic function
> mentions that the argument can be of type integer, real, or complex, and
> that all kinds are allowed. Thus also double precision ...
>
> If the summation is done in single precision, when the arguments are
> double precision, then it is a case of quality of implementation.
>
> Cheers,
>
>
> Matthijs van Waveren fecit
> Senior Researcher Fujitsu European Centre for Information
> Technology
> Tel. +44 (0)20 8606
> 4646 2, Longwalk Road, Stockley Park, Uxbridge,
> COINS: 7951-4646 UB11 1AB Middlesex, United Kingdom
> E-Mail : Fax +44 (0)20 8606 4422 - Tel. +44 (0)20
> [log in to unmask] 8573 4444
>
>
>
>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|