Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!mcvax!dik From: dik@cwi.nl (Dik T. Winter) Newsgroups: comp.lang.fortran Subject: Re: CDC FORTRAN trivia questions Keywords: arithmetic if logical Message-ID: <7694@boring.cwi.nl> Date: 1 Nov 88 23:16:24 GMT Article-I.D.: boring.7694 References: <1196@helios.ee.lbl.gov> <3616@s.cc.purdue.edu> <7691@boring.cwi.nl> <3624@s.cc.purdue.edu> Organization: CWI, Amsterdam Lines: 30 In article <3624@s.cc.purdue.edu> ags@s.cc.purdue.edu.UUCP (Dave Seaman) writes: > In article <7691@boring.cwi.nl> dik@cwi.nl (Dik T. Winter) writes: > >Beware, .FALSE. is +0; truth values returned by expressions could have any > >arithmetic value with negative for .TRUE. and positive for .FALSE.. > >So -0 is .TRUE. (yes, it is a 1-s complement machine). > > print 10, .true., .false. > 10 format(2(1x,o20)) > end > > for which the output was: > > 77777777777777777776 00000000000000000000 You missed something: I wrote: the constant .TRUE. is -1 indeed, but a logical expression could very well return -0 for .TRUE.. Try: logical function equal(i,j) equal = i.eq.j return end print 10, equal(1,1) 10 format(1x,o20) end the output is: 77777777777777777777 (yes, -0). (It might depend on the level of optimisation.) -- dik t. winter, cwi, amsterdam, nederland INTERNET : dik@cwi.nl BITNET/EARN: dik@mcvax