[an error occurred while processing this directive]
HP OpenVMS Systems Documentation |
HP Fortran for OpenVMS
|
Previous | Contents | Index |
Description: | Performs a circular shift of the rightmost bits. | ||
Class: | Elemental function; Generic | ||
Arguments: | I | Must be of type integer. | |
SHIFT | Must be of type integer. The absolute value for SHIFT must be less than or equal to SIZE. | ||
SIZE (opt) | Must be of type integer. The value of SIZE must be positive and must not exceed BIT_SIZE (I). If SIZE is omitted, it is assumed to have the value of BIT_SIZE (I). | ||
Results: |
The result type is the same as I. The result value is obtained by
circular shifting the SIZE rightmost bits of I by SHIFT positions. If
SHIFT is positive, the shift is to the left; if SHIFT is negative, the
shift is to the right. If SHIFT is zero, no shift is performed.
No bits are lost. Bits in I beyond the value specified by SIZE are unaffected. The model for the interpretation of an integer value as a sequence of bits is shown in Section D.3. For more information on bit functions, see Section 9.3.3. |
Specific Name | Argument Type | Result Type |
---|---|---|
IISHFTC | INTEGER(2) | INTEGER(2) |
JISHFTC | INTEGER(4) | INTEGER(4) |
KISHFTC | INTEGER(8) | INTEGER(8) |
Examples
ISHFTC (4, 2, 4) has the value 1.
ISHFTC (3, 1, 3) has the value 6.
If positive, I is shifted left (toward the most significant bit).
If negative, I is shifted right (toward the least significant bit).
Unlike circular or arithmetic shifts, which can shift ones into the
number being shifted, logical shifts shift in zeros only, regardless of
the direction or size of the shift. The integer kind, however, still
determines the end that bits are shifted out of, which can make a
difference in the result (see the following example).
Examples
Consider the following:
Examples
Consider the following:
A is assigned the value .TRUE. if B is an IEEE NaN; otherwise, the
value assigned is .FALSE..
9.4.77 ISHL (I, SHIFT)
Description:
Logically shifts an integer left or right by the specified bits. Zeros
are shifted in from the opposite end.
Class:
Elemental function; Generic
Arguments:
I
Must be of type integer. This argument is the value to be shifted.
SHIFT
Must be of type integer. This argument is the direction and distance of
shift.
Results:
The result type is the same as I. The result is equal to I logically
shifted by SHIFT bits. Zeros are shifted in from the opposite end.
INTEGER(1) i, res1
INTEGER(2) j, res2
i = 10 ! equal to 00001010
j = 10 ! equal to 00000000 00001010
res1 = ISHL (i, 5) ! returns 01000000 = 64
res2 = ISHL (j, 5) ! returns 00000001 01000000 = 320
9.4.78 ISNAN (X)
Description:
Tests whether IEEE real (S_floating and T_floating) numbers are
Not-a-Number (NaN) values. The compiler option /FLOAT=IEEE_FLOAT must
be set.
Class:
Elemental function; Generic
Arguments:
X must be of type real.
Results:
The result is of type default logical. The result is .TRUE. if X is an
IEEE NaN; otherwise, the result is .FALSE..
LOGICAL A
DOUBLE PRECISION B
...
A = ISNAN(B)
9.4.79 KIND (X)
Description: | Returns the value of the kind type parameter of the argument. For more information on kind type parameters, see Section 3.2. | ||
Class: | Inquiry function; Generic | ||
Arguments: | X can be of any intrinsic type. | ||
Results: | The result is a scalar of type default integer. The result has a value equal to the kind type parameter value of X. |
Examples
KIND (0.0) has the kind value of default real type.
KIND (12) has the kind value of default integer type.
9.4.80 LBOUND (ARRAY [,DIM] [,KIND])
Description: | Returns the lower bounds for all dimensions of an array, or the lower bound for a specified dimension. | ||
Class: | Inquiry function; Generic | ||
Arguments: | ARRAY | Must be an array (of any data type). It must not be an allocatable array that is not allocated, or a disassociated pointer. | |
DIM (opt) | Must be a scalar integer with a value in the range 1 to n, where n is the rank of ARRAY. | ||
KIND (opt) | Must be a scalar integer initialization expression. | ||
Results: |
The result is of type integer.
If KIND is present, the kind parameter of the result
is that specified by KIND; otherwise, the kind parameter of the result
is that of default integer. If the processor cannot represent the
result value in the kind of the result, the result is undefined.
If DIM is present, the result is a scalar. Otherwise, the result is a rank-one array with one element for each dimension of ARRAY. Each element in the result corresponds to a dimension of ARRAY. If ARRAY is an array section or an array expression that is not a whole array or array structure component, each element of the result has the value 1. If ARRAY is a whole array or array structure component, LBOUND (ARRAY, DIM) has a value equal to the lower bound for subscript DIM of ARRAY (if ARRAY(DIM) is nonzero). If ARRAY(DIM) has size zero, the corresponding element of the result has the value 1. The setting of compiler options that specify integer size can affect the result of this function. |
Examples
Consider the following:
REAL ARRAY_A (1:3, 5:8) REAL ARRAY_B (2:8, -3:20) |
LBOUND (ARRAY_A) is (1, 5). LBOUND (ARRAY_A, DIM=2) is 5.
LBOUND (ARRAY_B) is (2, --3). LBOUND (ARRAY_B (5:8, :)) is (1,1)
because the arguments are array sections.
The model for the interpretation of an integer value as a sequence
of bits is shown in Section D.3.
Examples
Consider the following:
9.4.81 LEADZ (I)
Description:
Returns the number of leading zero bits in an integer.
Class:
Elemental function; Generic
Arguments:
I must be of type integer.
Results:
The result type is the same as I. The result value is the number of
leading zeros in the binary representation of the integer I.
INTEGER*8 J, TWO
PARAMETER (TWO=2)
DO J= -1, 40
TYPE *, LEADZ(TWO**J) ! Prints 64 down to 23 (leading zeros)
ENDDO
END
9.4.82 LEN (STRING [,KIND])
Description: | Returns the length of a character expression. | ||
Class: | Inquiry function; Generic | ||
Arguments: | STRING | Must be of type character; it can be scalar or array valued. | |
KIND (opt) | Must be a scalar integer initialization expression. | ||
Results: |
The result is a scalar of type integer.
If KIND is present, the kind parameter of the result
is that specified by KIND; otherwise, the kind parameter of the result
is that of default integer. If the processor cannot represent the
result value in the kind of the result, the result is undefined.
The result has a value equal to the number of characters in STRING (if it is scalar) or in an element of STRING (if it is array valued). The setting of compiler options that specify integer size can affect the result of this function. |
Specific Name | Argument Type | Result Type |
---|---|---|
LEN | CHARACTER | INTEGER(4) |
CHARACTER | INTEGER(8) |
Examples
Consider the following example:
CHARACTER (15) C (50) CHARACTER (25) D |
LEN (C) has the value 15, and LEN (D) has the value 25.
9.4.83 LEN_TRIM (STRING [,KIND])
Description: | Returns the length of the character argument without counting trailing blank characters. | ||
Class: | Elemental function; Generic | ||
Arguments: | STRING | Must be of type character. | |
KIND (opt) | Must be a scalar integer initialization expression. | ||
Results: |
The result is a scalar of type integer.
If KIND is present, the kind parameter of the result
is that specified by KIND; otherwise, the kind parameter of the result
is that of default integer. If the processor cannot represent the
result value in the kind of the result, the result is undefined.
The result has a value equal to the number of characters remaining after any trailing blanks in STRING are removed. If the argument contains only blank characters, the result is zero. |
Examples
LEN_TRIM ( ' ---C--D--- ' ) has the value 7.
LEN_TRIM (
'
-----
'
) has the value 0.
9.4.84 LGE (STRING_A, STRING_B)
Description: | Determines if a string is lexically greater than or equal to another string, based on the ASCII collating sequence, even if the processor's default collating sequence is different. In HP Fortran, LGE is equivalent to the >= operator. | ||
Class: | Elemental function; Generic | ||
Arguments: | STRING_A | Must be of type character. | |
STRING_B | Must be of type character. | ||
Results: |
The result is of type default logical. If the strings are of unequal
length, the comparison is made as if the shorter string were extended
on the right with blanks, to the length of the longer string.
The result is true if the strings are equal, both strings are of zero length, or if STRING_A follows STRING_B in the ASCII collating sequence; otherwise, the result is false. |
Specific Name | Argument Type | Result Type |
---|---|---|
LGE 1 | CHARACTER | LOGICAL(4) |
Examples
LGE ( ' ONE ' , ' SIX ' ) has the value false.
LGE (
'
TWO
'
,
'
THREE
'
) has the value true.
9.4.85 LGT (STRING_A, STRING_B)
Description: | Determines whether a string is lexically greater than another string, based on the ASCII collating sequence, even if the processor's default collating sequence is different. In HP Fortran, LGT is equivalent to the > operator. | ||
Class: | Elemental function; Generic | ||
Arguments: | STRING_A | Must be of type character. | |
STRING_B | Must be of type character. | ||
Results: |
The result is of type default logical. If the strings are of unequal
length, the comparison is made as if the shorter string were extended
on the right with blanks, to the length of the longer string.
The result is true if STRING_A follows STRING_B in the ASCII collating sequence; otherwise, the result is false. If both strings are of zero length, the result is also false. |
Specific Name | Argument Type | Result Type |
---|---|---|
LGT 1 | CHARACTER | LOGICAL(4) |
Examples
LGT ( ' TWO ' , ' THREE ' ) has the value true.
LGT (
'
ONE
'
,
'
FOUR
'
) has the value true.
9.4.86 LLE (STRING_A, STRING_B)
Description: | Determines whether a string is lexically less than or equal to another string, based on the ASCII collating sequence, even if the processor's default collating sequence is different. In HP Fortran, LLE is equivalent to the <= operator. | ||
Class: | Elemental function; Generic | ||
Arguments: | STRING_A | Must be of type character. | |
STRING_B | Must be of type character. | ||
Results: |
The result is of type default logical. If the strings are of unequal
length, the comparison is made as if the shorter string were extended
on the right with blanks, to the length of the longer string.
The result is true if the strings are equal, both strings are of zero length, or if STRING_A precedes STRING_B in the ASCII collating sequence; otherwise, the result is false. |
Specific Name | Argument Type | Result Type |
---|---|---|
LLE 1 | CHARACTER | LOGICAL(4) |
Examples
LLE ( ' TWO ' , ' THREE ' ) has the value false.
LLE (
'
ONE
'
,
'
FOUR
'
) has the value false.
9.4.87 LLT (STRING_A, STRING_B)
Description: | Determines whether a string is lexically less than another string, based on the ASCII collating sequence, even if the processor's default collating sequence is different. In HP Fortran, LLT is equivalent to the < operator. | ||
Class: | Elemental function; Generic | ||
Arguments: | STRING_A | Must be of type character. | |
STRING_B | Must be of type character. | ||
Results: |
The result is of type default logical. If the strings are of unequal
length, the comparison is made as if the shorter string were extended
on the right with blanks, to the length of the longer string.
The result is true if STRING_A precedes STRING_B in the ASCII collating sequence; otherwise, the result is false. If both strings are of zero length, the result is also false. |
Specific Name | Argument Type | Result Type |
---|---|---|
LLT 1 | CHARACTER | LOGICAL(4) |
Examples
LLT ( ' ONE ' , ' SIX ' ) has the value true.
LLT ( ' ONE ' , ' FOUR ' ) has the value false.
Previous | Next | Contents | Index |