and(3I)
AND - Computes logical product
Showing IRIX 6.5.30 (default release). Last changed in IRIX 6.5.19.
NAME AND - Computes logical product SYNOPSIS AND ([I=]i,[J=]j) STANDARDS Fortran extension DESCRIPTION AND is an elemental function. It accepts the following arguments: i Must be of type Boolean, integer, real, Cray pointer, or logical. j Must be of type Boolean, integer, real, Cray pointer, or logical. NOTES AND is an outmoded routine. Refer to the MIPSpro Fortran Language Reference Manual, Volume 3, for information about outmoded features and their preferred standard alternatives. The name of this intrinsic cannot be passed as an argument. 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 When given two arguments of type logical, AND computes a logical product and returns a logical result. When given two arguments of type Boolean, integer, real, or pointer, AND computes a bit-wise logical product and returns an integer result (on IRIX systems). The following tables show both the logical product and bit-wise logical product: --------------------------------------------------------------------- Logical Variable 1 Logical Variable 2 (Logical Variable 1) AND (Logical Variable 2) --------------------------------------------------------------------- T T T T F F F T F F F F --------------------------------------------------------------------- ------------------------------------------------------------------ Bit of Variable 1 Bit of Variable 2 (Bit of Variable 1) AND (Bit of Variable 2) ------------------------------------------------------------------ 1 1 1 1 0 0 0 1 0 0 0 0 ------------------------------------------------------------------ EXAMPLES The following section of Fortran code shows the AND function used with two arguments of type logical: LOGICAL L1, L2, L3 ... L3 = AND(L1,L2) The following section of Fortran code shows the AND 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 = AND(I1,I2) ------------------------------- ------------------------------- | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | ------------------------------- ------------------------------- I1 I2 ------------------------------- | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | ------------------------------- I3