Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!decwrl!sgi!shinobu!odin!dinkum!calvin From: calvin@dinkum.sgi.com (Calvin H. Vu) Newsgroups: comp.lang.fortran Subject: Re: Strange EQUIVALENCES and data inits Message-ID: <4163@odin.SGI.COM> Date: 15 Feb 90 02:10:44 GMT References: <14121@s.ms.uky.edu> <13160004@acf4.NYU.EDU> Sender: news@odin.SGI.COM Lines: 61 In article <13160004@acf4.NYU.EDU> mcqueen@acf4.NYU.EDU (David M. McQueen) writes: >/* acf4:comp.lang.fortran / morgan@ms.uky.edu (Wes Morgan) / 3:02 pm Feb 12, 1990 */ >> I am attempting to port the PD MATLAB package to a 3B20 with f77. >> The following chunk of code refuses to compile: >> >> DOUBLE PRECISION MASK(14),XX,MM >> real mas(2,14) >> equivalence (mask(1),mas(1)) >> data mas/ ...................................................... >> The opinions expressed above are not those of UKECC unless so noted. >> Wes Morgan \ {rutgers,rayssd,uunet}!ukma!ukecc!morgan >> University of Kentucky \ or morgan@engr.uky.edu >> Engineering Computing Center \ or morgan%engr.uky.edu@UKMA.BITNET >> /* ---------- */ >I have tried your code on several machines here at NYU's Academic Computing >Facility, each purporting to use f77. I added a small loop below your data >statement to see what appears to be stored in MASK: > do 100 k=1,14 > write(6,*) MASK(k) > 100 continue >On 3 out of 5 machines, the code compiles and then executes. On two of those >3 (Sun-3, IRIS 4D80GT) the same answers result: > ....................................................... >and on the third (a VAX running BSD 4.3): > ......................................................... >I don't know specifically which vendors have supplied the f77's for each of >my machines, but clearly the results are 'system-dependent'. It is not really system-dependent, only the bit pattern will be interpreted differently on the different systems. SGI and SUN uses IEEE format for floating-point numbers so the results are the same, VAX VMS uses a different format so you see something different when you try to print out the bit patterns as decimal numbers. I suspect that if you had used: write(6,10) MASK(k) 10 format(z16) to print out the bit patterns then the results would have be the same on the three machines which allow this syntax. For the machine which do not allow this syntax for hexadeciaml constants, try the followings: 'hexstring'x or x'hexstring' $hexstring the form 'hexstring'x is the most popular form and should work on all machines. Anyway, look at your Fortran Reference Manual to see which form of hex. constant they support. They must support one form or another. Calvin Vu ----------------------------------------------------------------------------- "Don't flame me. I never check my guesses and provide no guarantee for them"