![]() |
Software > OpenVMS Systems > Documentation > 82final > 6324 ![]() HP OpenVMS Systems Documentation |
![]() |
HP Fortran for OpenVMS
|
Previous | Contents | Index |
Description: | Returns the exponent part of the argument when represented as a model number. | ||
Class: | Elemental function; Generic | ||
Arguments: | X must be of type real. | ||
Results: |
The result is of type default integer. If X is not equal to zero, the
result value is the exponent part of X. The exponent must be within
default integer range; otherwise, the result is undefined.
If X is zero, the exponent of X is zero. For more information on the exponent part ( e) in the real model, see Section D.2. |
Examples
EXPONENT (2.0) has the value 2.
If 4.1 is a REAL(4) value, EXPONENT (4.1) has the value 3.
Description: | Returns the greatest integer less than or equal to its argument. | ||
Class: | Elemental function; Generic | ||
Arguments: | A | Must be of type real. | |
KIND (opt) | Must be a scalar integer initialization expression. This argument is a Fortran 95 feature. | ||
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.
The value of the result is equal to the greatest integer less than or equal to A. |
Examples
FLOOR (4.8) has the value 4.
FLOOR (--5.6) has the value --6.
Description: | Returns the class of an IEEE real (S_floating, T_floating, or X_floating) argument. The compiler option specifying IEEE floating format must be set. | ||
Class: | Elemental function; Generic | ||
Arguments: | X must be of type real. | ||
Results: |
The result is of type default integer. The return value is one of the
following:
Class of Argument Return Value The preceding return values are defined in module FORSYSDEF. For information on the location of this file, see the HP Fortran for OpenVMS User Manual. |
Examples
FP_CLASS (4.0_8) has the value 4 (FOR_K_FP_POS_NORM, a normal positive number).
Description: | Returns the fractional part of the model representation of the argument value. | ||
Class: | Elemental function; Generic | ||
Arguments: | X must be of type real. | ||
Results: | The result type is the same as X. The result has the value X x b -e . Parameters b and e are defined in Section D.2. If X has the value zero, the result has the value zero. |
Examples
If 3.0 is a REAL(4) value, FRACTION (3.0) has the value 0.75.
Description: | Frees a block of memory that is currently allocated. | ||
Class: | Subroutine | ||
Arguments: |
A must be of type INTEGER(8). This value is the starting address of the
memory to be freed, previously allocated by MALLOC (see Section 9.4.92).
If the freed address was not previously allocated by MALLOC, or if an address is freed more than once, results are unpredictable. |
Examples
Consider the following:
INTEGER(4) ADDR, SIZE SIZE = 1024 ! Size in bytes ADDR = MALLOC(SIZE) ! Allocate the memory CALL FREE(ADDR) ! Free it END |
Description: | Returns the largest number in the model representing the same type and kind parameters as the argument. | ||
Class: | Inquiry function; Generic | ||
Arguments: | X must be of type integer or real; it can be scalar or array valued. | ||
Results: |
The result is a scalar of the same type and kind parameters as X. If X
is of type integer, the result has the value r
q - 1 . If X is of type real, the result has the value (1 - b
-p) b
e_max .
Integer parameters r and q are defined in Section D.1; real parameters b, p, and e max are defined in Section D.2. |
Examples
If X is of type REAL(4), HUGE (X) has the value (1 - 2-24) x 2128 .
Description: | Returns the position of a character in the ASCII character set, even if the processor's default character set is different. In HP Fortran, IACHAR is equivalent to the ICHAR function. | ||
Class: | Elemental function; Generic | ||
Arguments: | C must be of type character of length 1. | ||
Results: |
The result is of type default integer. If C is in the ASCII collating
sequence, the result is the position of C in that sequence and
satisfies the inequality (0 <= IACHAR(C) <= 127).
The results must be consistent with the LGE, LGT, LLE, and LLT lexical comparison functions. For example, if LLE(C, D) is true, IACHAR(C) .LE. IACHAR(D) is also true. |
Examples
IACHAR ( ' Y ' ) has the value 89.
IACHAR ( ' % ' ) has the value 37.
Description: | Performs a logical AND on corresponding bits. 1 | ||
Class: | Elemental function; Generic | ||
Arguments: | I | Must be of type integer. | |
J | Must be of type integer with the same kind parameter as I. | ||
Results: |
The result type is the same as I. The result value is derived by
combining I and J bit-by-bit according to the following truth table:
I J IAND (I, J) The model for the interpretation of an integer value as a sequence of bits is shown in Section D.3. |
Specific Name | Argument Type | Result Type |
---|---|---|
INTEGER(1) | INTEGER(1) | |
IIAND | INTEGER(2) | INTEGER(2) |
JIAND | INTEGER(4) | INTEGER(4) |
KIAND | INTEGER(8) | INTEGER(8) |
Examples
IAND (2, 3) has the value 2.
Description: | Returns the count of actual arguments passed to the current routine. | ||
Class: | Inquiry function; Specific | ||
Arguments: | None. | ||
Results: |
The result is of type default integer. Functions with a type of
CHARACTER, COMPLEX(8), REAL(16), and COMPLEX(16) have an extra argument
added that is used to return the function value.
Formal (dummy) arguments that can be omitted must be declared VOLATILE. For more information, see Section 5.19. Formal arguments of type CHARACTER cannot be omitted. Formal arguments that are adjustable arrays (see Section 5.1.4.1) cannot be omitted. The standard way to pass and detect omitted arguments is to use the Fortran 95 features of OPTIONAL arguments and the PRESENT intrinsic function. Note that a declaration must be visible within the calling routine. |
Examples
Consider the following:
CALL SUB (A,B) ... SUBROUTINE SUB (X,Y,Z) VOLATILE Z TYPE *, IARGCOUNT() ! Displays the value 2 |
For more information, including an example, see Section 8.8.1.2.
Description: | Returns a pointer to the actual argument list for the current routine. | ||
Class: | Inquiry function; Specific | ||
Arguments: | None. | ||
Results: |
The result is of type INTEGER(8). The actual argument list is an array
of values of the same type.
The first element in the array contains the argument count; subsequent elements contain the INTEGER(8) address of the actual arguments. Formal (dummy) arguments that can be omitted must be declared VOLATILE. For more information, see Section 5.19. |
Examples
Consider the following:
WRITE (*,'(" Address of argument list is ",Z16.8)') IARGPTR() |
Description: | Reverses the value of a specified bit in an integer. | ||
Class: | Elemental function; Generic | ||
Arguments: | I | Must be of type integer. This argument contains the bit to be reversed. | |
POS |
Must be of type integer. This argument is the position of the bit to be
changed.
The rightmost (least significant) bit of I is in position 0. |
||
Results: |
The result type is the same as I. The result is equal to I with the bit
in position POS reversed.
For more information on bit functions, see Section 9.3.3. |
Examples
Consider the following:
INTEGER J, K J = IBCHNG(10, 2) ! returns 14 = 1110 K = IBCHNG(10, 1) ! returns 8 = 1000 |
Description: | Clears one bit to zero. | ||
Class: | Elemental function; Generic | ||
Arguments: | I | Must be of type integer. | |
POS |
Must be of type integer. It must not be negative and it must be less
than BIT_SIZE (I).
The rightmost (least significant) bit of I is in position 0. |
||
Results: |
The result type is the same as I. The result has the value of the
sequence of bits of I, except that bit POS of I is set to zero. 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 |
---|---|---|
INTEGER(1) | INTEGER(1) | |
IIBCLR | INTEGER(2) | INTEGER(2) |
JIBCLR | INTEGER(4) | INTEGER(4) |
KIBCLR | INTEGER(8) | INTEGER(8) |
Examples
IBCLR (18, 1) has the value 16.
If V has the value (1, 2, 3, 4), the value of IBCLR (POS = V, I = 15) is (13, 11, 7, 15).
Description: | Extracts a sequence of bits (a bit field). | ||
Class: | Elemental function; Generic | ||
Arguments: | I | Must be of type integer. | |
POS |
Must be of type integer. It must not be negative and POS + LEN must be
less than or equal to BIT_SIZE (I).
The rightmost (least significant) bit of I is in position 0. |
||
LEN | Must be of type integer. It must not be negative. | ||
Results: |
The result type is the same as I. The result has the value of the
sequence of LEN bits in I, beginning at POS right-adjusted and with all
other bits zero. 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 |
---|---|---|
INTEGER(1) | INTEGER(1) | |
IIBITS | INTEGER(2) | INTEGER(2) |
JIBITS | INTEGER(4) | INTEGER(4) |
KIBITS | INTEGER(8) | INTEGER(8) |
Examples
IBITS (12, 1, 4) has the value 6.
IBITS (10, 1, 7) has the value 5.
Description: | Sets one bit to 1. | ||
Class: | Elemental function; Generic | ||
Arguments: | I | Must be of type integer. | |
POS |
Must be of type integer. It must not be negative and it must be less
than BIT_SIZE (I).
The rightmost (least significant) bit of I is in position 0. |
||
Results: |
The result type is the same as I. The result has the value of the
sequence of bits of I, except that bit POS of I is set to 1. 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 |
---|---|---|
INTEGER(1) | INTEGER(1) | |
IIBSET | INTEGER(2) | INTEGER(2) |
JIBSET | INTEGER(4) | INTEGER(4) |
KIBSET | INTEGER(8) | INTEGER(8) |
Examples
IBSET (8, 1) has the value 10.
If V has the value (1, 2, 3, 4), the value of IBSET (POS = V, I = 2) is (2, 6, 10, 18).
Description: | Returns the position of a character in the processor's character set. | ||
Class: | Elemental function; Generic | ||
Arguments: | C must be of type character of length 1. | ||
Results: |
The result is of type default integer. The result value is the position
of C in the processor's character set. C is in the range zero to n - 1,
where
n is the number of characters in the character set.
For any characters C and D (capable of representation in the processor), C .LE. D is true only if ICHAR(C) .LE. ICHAR(D) is true, and C .EQ. D is true only if ICHAR(C) .EQ. ICHAR(D) is true. |
Specific Name | Argument Type | Result Type |
---|---|---|
CHARACTER | INTEGER(2) | |
ICHAR 1 | CHARACTER | INTEGER(4) |
CHARACTER | INTEGER(8) |
Examples
ICHAR ( ' W ' ) has the value 87.
ICHAR ( ' # ' ) has the value 35.
Previous | Next | Contents | Index |