fpt and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Ref Manual Home |
CHANGE .EQ. FOR LOGICAL TO .EQV.
Syntax:
[DO NOT] CHANGE [.]EQ[.] FOR LOGICAL TO [.]EQV[.]
[DO NOT] CHANGE [.]EQ[.] TO [.]EQV[.] FOR LOGICALS
Function:
Expressions of the form L1 .EQ. L2 or L1 .NE. L2 where L1 and L2 are logical variables or expressions are changed to (L1 .EQV. L2) or (L1 .NEQV. L2). Note that the Fortran 77 standard requires the use of .EQV. and .NEQV.for logicals, and .EQ. and .NE.are not supported for logicals by some compilers, notably gfortran.
Note that the sub-expression around the original .EQ., ==, .NE. or /= operator is enclosed in parentheses. This is done because .EQ. and .NE. have higher operator precedence than .EQV. and .NEQV.. Thus, if lr, t and f are logical variables, t has the value .TRUE. and f has the value .FALSE., the expression:
lr = f .AND. t .EQ. t .AND. f
evaluates as f .AND. (t .EQ. t) .AND. f which is .FALSE..
The expression:
lr = f .AND. t .EQV. t .AND. f
evaluates as (f .AND. t) .EQV. (t .AND. f) which is .TRUE..
The insertion of the parentheses is made in fpt version 3.9-d and later. Thanks are due to Dan Leslie at Sector7 Inc. for pointing out the need for this change.
Where to Use this Command
Operating system command line | Yes |
Configuration file, config.fsp | Yes |
Specification (fsp) files, *.fsp | Yes |
Interactively, to FPT> prompt | Yes |
Interactive command files | Yes |
Embedded in the Fortran code | No |
Default
No change is made by default.
Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.