John Blair-Fish wrote:
>One of my users here has tried an example from a textbook to
>write a postscript file. Initial values are given to two variables
>graphics_unit and scale in the MODULE graph_ps.
>These values are 20 and 400. These are printed in the main
>program to default output. With Salford ftn95 4.5 the values are
>printed as 1137180672 and 0.000000E+00. Sun Fortran prints
>them correctly. These is some discussion as to whither module
>variables which re not parameters can be given initial values.
>What does the standard say?
>
>
>MODULE graph_ps
> ! type definition
> TYPE point
> REAL :: x , y
> END TYPE point
> ! global data
> REAL :: scale = 400.0
> INTEGER :: graphics_unit = 20
>
>
I'd just note that the following program, when run on a 32-bit IEEE machine:
real :: x
x = transfer(1137180672, 1.0)
print *, x
end
prints out 400.0000.
It appears that the addresses or the types of the data have been mixed
up. Printing an integer 20 as a floating point value will give a 0.0,
which could explain the other value printed.
This is not an issue about the Fortran standard, which others have noted
is pretty clear on this subject. There does appear to be a problem with
you compiler, though.
Cheers,
Bill
>
>
--
Bill Long [log in to unmask]
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
|