eqv(3I)
EQV, NEQV - Computes logical equivalence or difference
As shipped in IRIX 6.5.22. Last changed in IRIX 6.5.19.
NAME EQV, NEQV - Computes logical equivalence or difference SYNOPSIS EQV ([I=]i,[J=]j) NEQV ([I=]i,[J=]j) XOR ([I=]i,[J=]j) STANDARDS Fortran extensions DESCRIPTION EQV computes a logical equivalence. This function is not accepted by the MIPSpro Fortran 77 compiler. NEQV and XOR are two names for the same routine. These functions compute a logical difference. NEQV is not accepted by the MIPSpro Fortran 77 compiler. These functions accept the following arguments: i Must be of type Boolean, integer, real, logical, or Cray pointer. j Must be of type Boolean, integer, real, logical, or Cray pointer. For EQV, j need not be the same type as i, but j must be the same size as i. These are elemental functions. The names of these intrinsics cannot be passed as arguments. NOTES These routines are outmoded. Refer to the MIPSpro Fortran Language Reference Manual, Volume 3, for information about outmoded features and their preferred standard alternatives. CAUTIONS Unexpected results can occur when Boolean functions are declared external and then used with logical arguments. The external Boolean functions always treat their arguments as type Boolean and return an integer result. RETURN VALUES EQV, when given two arguments of type Boolean, real, integer, or pointer, computes a bit-wise logical equivalence and returns an integer result. When both i and j are of type logical, the result is of type logical. The following tables show both the logical equivalence and bit-wise logical equivalence: ----------------------------------------------------------------- Logical Variable 1 Logical Variable 2 (Logical Variable 1) EQV (Logical Variable 2) ----------------------------------------------------------------- T T T T F F F T F F F T ----------------------------------------------------------------- -------------------------------------------------------------- Bit of Variable 1 Bit of Variable 2 (Bit of Variable 1) EQV (Bit of Variable 2) -------------------------------------------------------------- 1 1 1 1 0 0 0 1 0 0 0 1 -------------------------------------------------------------- NEQV and XOR, when given two arguments of type logical, compute a logical difference and return a logical result. When given two arguments of type Boolean, integer, real, or pointer, NEQV and XOR compute a bit-wise logical difference and return a Boolean result. The following tables show both the logical difference and bit-wise logical difference. NEQV is shown in the tables, but XOR produces identical results. ----------------------------------------------------------------- Logical Variable 1 Logical Variable 2 (Logical Variable 1) NEQV (Logical Variable 2) ----------------------------------------------------------------- T T F T F T F T T F F F ----------------------------------------------------------------- -------------------------------------------------------------- Bit of Variable 1 Bit of Variable 2 (Bit of Variable 1) NEQV (Bit of Variable 2) -------------------------------------------------------------- 1 1 0 1 0 1 0 1 1 0 0 0 -------------------------------------------------------------- EXAMPLES Example 1. The following section of Fortran code shows the EQV function used with two arguments of type logical: LOGICAL L1, L2, L3 ... L3 = EQV(L1,L2) Example 2. The following section of Fortran code shows the EQV function used with two arguments of type integer. The bit patterns of the arguments and result are also given. For clarity, only the rightmost 8 bits are shown. INTEGER I1, I2, I3 I1 = 12 I2 = 10 ... I3 = EQV(I1,I2) ------------------------------- ------------------------------- | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | ------------------------------- ------------------------------- I1 I2 ------------------------------- | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | ------------------------------- I3 Example 3. The following section of Fortran code shows the NEQV function used with two arguments of type logical. XOR is used in the same manner and produces the same results. LOGICAL L1, L2, L3 ... L3 = NEQV(L1,L2) Example 4. The following section of Fortran code shows the NEQV function used with two arguments of type integer. XOR is used in the same manner and produces the same results. The bit patterns of the arguments and results are also given. For clarity, only the rightmost 8 bits are shown. INTEGER I1, I2, I3 I1 = 12 I2 = 10 ... I3 = NEQV(I1,I2) ------------------------------- ------------------------------- | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | ------------------------------- ------------------------------- I1 I2 ------------------------------- | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | ------------------------------- I3