compl

Date:

10-12-2011

NAME

COMPL - Computes complement

SYNOPSIS

COMPL ([I=]i)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran extension

DESCRIPTION

The COMPL intrinsic function computes the complement of i. It accepts the following argument:

i

A Boolean, integer, real, logical, or Cray pointer value.

COMPL is an elemental function. The name of this intrinsic cannot be passed as an argument.

The following tables show both the logical complement and the bit-wise logical complement:

---------------------------------------------
Logical Variable   COMPL (Logical Variable)
---------------------------------------------
T                  F
F                  T
---------------------------------------------

---------------------------------------------
Bit of Variable    COMPL (Bit of Variable)
---------------------------------------------
1                  0
0                  1
---------------------------------------------

NOTES

COMPL is outmoded. Refer to the Cray Fortran Reference Manual 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 a Boolean result.

RETURN VALUES

When given an argument of type logical, COMPL computes a logical complement and returns a logical result.

With an argument of type integer, real, Boolean, or Cray pointer, COMPL computes a bit-wise logical complement and returns a Boolean result. No type conversion occurs.

EXAMPLES

The following section of Fortran code shows the COMPL function used with an argument of type logical:

LOGICAL L1, L2
L2 = COMPL(L1)

The following section of Fortran code shows the COMPL function used with an argument of type integer. The bit patterns of the argument and result are also given. For clarity, only the rightmost 8 bits are shown.

INTEGER I1, I2
I1 = 240
I2 = COMPL(I1)

       -------------------------------
      | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
       -------------------------------
                   I1
       -------------------------------
      | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
       -------------------------------
                   I2