Print

Print


> > In point of fact, I'll remind you that Digital/Compaq(/HP)
> > Fortran for Alpha does indeed store .false. as 0 and .true.
> > as ~0 (or -1 for those still thinking in two's complement),

If you do a TRANSFER((.TRUE.),(X)) and print it out, you get -1 if X is
INTEGER and -(HUGE(X)) if X is real (-1.7014117E+38).  (For .FALSE., you
get 0 and 0.0000000E+00).

Also, it doesn't have IEEE format, but another format (designed for
compatibility with the VAX format) and ALPHA, at least with VMS, is
little-endian.

Fortunately, none of this matters if one uses standard Fortran.  That's
one purpose of a standard: transparency with regard to the underlying
architecture.

> > and uses even/odd as the testing method.  And they are easily
> > converted to - and ~0/-1; as another poster said, these are
> > just bit patterns and they take on "value" when you impose an
> > interpretation on them.  They aren't the right values or the
> > wrong values for anything, until you declare the consistent
> > context which imposes an interpretation.  What's your context
> > to claim they are the wrong values?
>
> I think you'll find that the even/odd testing goes back to the Vaxs (or
> earlier) where INTEGERs could be used interchangeably with LOGICALs, and
> status codes could be coded as odd numbers for failure and even for
> success. So you would use "IF (status)" to test for success, where
> status could be any one of many possible values treated as either .true.
> or .false..

If you're thinking of VMS status codes, even are bad and odd are good.
In particular, 0 is warning, 2 is error and 4 is fatal error; 1 is
success, 3 is informational.  (These are actually the 3 lowest-order
bits, known as $SEVERITY.  $STATUS is 32 bits and codes for many other
things as well.

> The proper definition of a logical data type is a big plus for Fortran.
> Program by the standard and you never have to worry about the underlying
> implementation. It really does not matter.

Right.