I have encountered a problem with the use of the logical function
"EQV" which appears not to work when used with variables declared
as logical*1.
The following program when compiled in the ways suggested will
illustrate the problem
I would welcome comments
Peter Bladon
(cba…@vaxa.strath.ac.uk)
Phone/fax +44 (0)41-776-1718
—————————-cut here——————————
Program testeqv
C To test the action of the logical ‘eqv’ operator
C which does not work with logical*1 variables!!!
C There are two statements where the logical variables
C a, b, c, and d are declared in two alternative ways.
C One and only one of these statements must be "active",
C the other one must be commented-out.
C When this small program is compiled with the
C variables a,b,c,d declared as logical (*4) in the
C normal way, then the correct values of c and d
C are computed. When the logicals are declared as
C logical*1, then the operator EQV does not compute
C correctly. The alternative (longwinded) statement
C using AND and OR operators does give the correct
C results with both the logical*4 and logical*1
C alternatives.
C Identical behaviour was found using the 3.5.1 and 4.0.1
C versions of the fortran compiler, under IRIX 4.0.5
C and 5.2 respectively.
logical a,b,c,d
C logical*1 a,b,c,d
10 continue
write (6,6000)
write (6,6001)
read (5,5001) a,b
write (6,6006)
c = (a.eqv.b)
write (6,6002) c
if (c) then
write (6,6003)
else
write (6,6004)
endif
write (6,6005)
d = ((a.and.b).or.((.not.a).and.(.not.b)))
write (6,6002) d
if (d) then
write (6,6003)
else
write (6,6004)
endif
go to 10
5001 format (2l1)
6000 format (‘——————————————————’)
6001 format (‘Enter as "tt","ff","tf", or "ft" the values of A and B’)
6002 format (l1)
6003 format (‘A and B have the same logical state’)
6004 format (‘A and B do not have the same logical state’)
6005 format (//’Use of AND and OR operators’)
6006 format (//’Use of EQV operator’)
end
—————————-cut here——————————