This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Testing g77 with LAPACK 3.0


Hi

This is from a while ago, but I note that in f90

CMPLX(1.0E0,1.0E0) == CMPLX(1.0D0,1.0D0) 

i.e. cmplx(.x.,.y.) returns a default complex type.  This is
independent of the types of its arguements, unless the optional kind
argument is supplied.  I have seen this in several F90 codes, and is
(to many users) a not-so-obvious cause of loss of precision.

I dont know about the g77 implementation of CMPLX.

Kevin

Craig wrote:
> It is due to non-standard code, though it's a popular-enough idiom that,
> perhaps, g77 should support it someday, at least for legacy code.
> 
> Note that I'd recommend using a patch like this instead, to maintain
> code readability:
> 
> -      ALPHA = ( ONE, -ONE )
> -      BETA = ( TWO, -TWO )
> +      ALPHA = CMPLX ( ONE, -ONE )
> +      BETA = CMPLX ( TWO, -TWO )
>        RALPHA = ONE
>        RBETA = TWO
>  *
> --- BLAS/TESTING/cblat3.f.0     Sun Jun  9 12:15:54 1996
> +++ BLAS/TESTING/cblat3.f       Mon Jul  5 11:50:16 1999
> @@ -1989,8 +1989,8 @@
>  *
>  *     Initialize ALPHA, BETA, RALPHA, and RBETA.
>  *
> -      ALPHA = ( ONE, -ONE )
> -      BETA = ( TWO, -TWO )
> +      ALPHA = CMPLX ( ONE, -ONE )
> +      BETA = CMPLX ( TWO, -TWO )
> 
>         tq vm, (burley)
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]