[comp.sys.sun] Problem converting float -> double complex

caspar@wn2.sci.kun.nl (Caspar Terheggen) (10/19/89)

This article is cross posted to two groups because I don't know
whether it's a Fortran or a Sun question. Can someone explain
this behavior? Is it valid Fortran77?

Script started on Thu Oct 12 09:30:00 1989
% more try.f
      complex*16 z1,z2
      z1 = 1.0
      z2 = 1.0/1.0
      write(*,*) z1,z2
      end
% make try
f77   -sun4 -o try try.f 
try.f:
 MAIN:
% try
  (    1.0000000000000,  0.)  (    25.968750000000,  0.)
% exit
script done on Thu Oct 12 09:30:20 1989

Why did the conversion to complex*16 go right in one case and wrong in the
other? I would expect that in both cases a real*4 must be converted to
complex*16. I am running SunOS 4.0.3_Export #1 on a Sun4. As for the
compiler: strings /usr/bin/f77 gives (among others) @(#)compile.c 1.70
88/04/18 SMI.  Any help (e-mail or followup) is appreciated. Thanks in
advance.

ehrlich@cs.psu.edu (Daniel Ehrlich) (10/21/89)

In article <2285@brazos.Rice.edu> caspar@wn2.sci.kun.nl (Caspar Terheggen) writes:

>This article is cross posted to two groups because I don't know
>whether it's a Fortran or a Sun question. Can someone explain
>this behavior? Is it valid Fortran77?
>
>Script started on Thu Oct 12 09:30:00 1989
>...
>% try
>  (    1.0000000000000,  0.)  (    25.968750000000,  0.)
>% exit
>script done on Thu Oct 12 09:30:20 1989
>
>Why did the conversion to complex*16 go right in one case and wrong in the
>other? I would expect that in both cases a real*4 must be converted to
>complex*16. I am running SunOS 4.0.3_Export #1 on a Sun4. As for the
>compiler: strings /usr/bin/f77 gives (among others) @(#)compile.c 1.70
>88/04/18 SMI.  Any help (e-mail or followup) is appreciated. Thanks in
>advance.

This works fine on my 4/280S running SunOS 4.0.3 Domestic.  Get your FE to
check out your machine.  We have Sun4 FORTARN V1.2.  Look in the file
/usr/lib/lang_info for the version of your compiler.  This gets updated by
the install script so if the compiler was just copied into place from
another system you will have to check on that system.

Script started on Sat Oct 21 09:45:34 1989
psuvax1:26> cat try.f
        complex*16 z1,z2
        z1 = 1.0
        z2 = 1.0/1.0
        write (*,*) z1, z2
        end
psuvax1:27> rm -f try
psuvax1:28> \make try
f77   -sun4 -o try try.f 
try.f:
 MAIN:
psuvax1:29> ./try
  (    1.0000000000000,  0.)  (    1.0000000000000,  0.)
psuvax1:30> ^D
script done on Sat Oct 21 09:46:03 1989

Dan Ehrlich <ehrlich@cs.psu.edu>   | "A message is not a message until the
The Pennsylvania State University  | rules for interpreting it are in the
Department of Computer Science     | hands of the reciever."
University Park, PA   16802        |    --Apollo Belvedere Smith