HP OpenVMS Systems Documentation 
HP Fortran for OpenVMS

Previous  Contents  Index 
Description:  Converts the argument to COMPLEX(16) type. This function must not be passed as an actual argument.  
Class:  Elemental function; Generic  
Arguments:  X  Must be of type integer, real, or complex.  
Y (opt)  Must be of type integer or real. It must not be present if X is of type complex.  
Results: 
The result is of type COMPLEX(16) (or COMPLEX*32).
If only one noncomplex argument appears, it is converted into the real part of the result value and zero is assigned to the imaginary part. If Y is not specified and X is complex, the result value is CMPLX (REAL(X), AIMAG(X)). If two noncomplex arguments appear, the complex value is produced by converting the first argument into the real part of the value, and converting the second argument into the imaginary part. QCMPLX(X, Y) has the complex value whose real part is REAL(X, KIND=16) and whose imaginary part is REAL(Y, KIND=16). 
Examples
QCMPLX (3) has the value (3.0Q0, 0.0Q0).
QCMPLX (4.1, 2.3) has the value (4.1Q0, 2.3Q0).
Description:  Converts a number to quad precision (REAL(16)) type.  
Class:  Elemental function; Generic  
Arguments:  A must be of type integer, real, or complex.  
Results: 
The result is of type REAL(16) (REAL*16). Functions that cause
conversion of one data type to another type have the same effect as the
implied conversion in assignment statements.
If A is of type REAL(16), the result is the value of the A with no conversion (QEXT(A) = A). If A is of type integer or real, the result has as much precision of the significant part of A as a REAL(16) value can contain. If A is of type complex, the result has as much precision of the significant part of the real part of A as a REAL(16) value can contain. 
Specific Name^{1}  Argument Type  Result Type 

INTEGER(1)  REAL(16)  
INTEGER(2)  REAL(16)  
INTEGER(4)  REAL(16)  
INTEGER(8)  REAL(16)  
QEXT  REAL(4)  REAL(16) 
QEXTD  REAL(8)  REAL(16) 
REAL(16)  REAL(16)  
COMPLEX(4)  REAL(16)  
COMPLEX(8)  REAL(16)  
COMPLEX(16)  REAL(16) 
Examples
QEXT (4) has the value 4.0 (rounded; there are 32 places to the right of the decimal point).
QEXT ((3.4, 2.0)) has the value 3.4 (rounded; there are 32 places to the right of the decimal point).
Description:  Converts an integer to quad precision (REAL(16)) type.  
Class:  Elemental function; Generic  
Arguments:  A must be of type integer.  
Results: 
The result is of type REAL(16) (REAL*16).
Functions that cause conversion of one data type to another type have the same affect as the implied conversion in assignment statements. 
Examples
QFLOAT (4) has the value 4.0 (rounded; there are 32 places to the right of the decimal point).
Description:  Converts the real part of a COMPLEX(16) argument to REAL(16) type. This is a specific function that has no generic function associated with it. It must not be passed as an actual argument.  
Class:  Elemental function; Specific  
Arguments:  A must be of type COMPLEX(16) (or COMPLEX*32).  
Results:  The result is of type REAL(16) (or REAL*16). 
Examples
QREAL ((2.0q0, 3.0q0)) has the value 2.0q0.
Description:  Returns the base of the model representing numbers of 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 type default integer. For an integer argument, the result has the value r (as defined in Section D.1). For a real argument, the result has the value b (as defined in Section D.2). 
Examples
If X is a REAL(4) value, RADIX (X) has the value 2.
Description: 
Returns the next number from a sequence of pseudorandom numbers of
uniform distribution over the range 0 to 1.
This is a specific function that has no generic function associated with it. It must not be passed as an actual argument. It is not a pure function, so it cannot be referenced inside a FORALL construct. 

Class:  Nonelemental function; Specific  
Arguments: 
I is the
seed. It must be an INTEGER(4) variable or array element.
It should initially be set to a large, odd integer value. The RAN function stores a value in the argument that is later used to calculate the next random number. There are no restrictions on the seed, although it should be initialized with different values on separate runs to obtain different random numbers. 

Results:  The result is of type REAL(4). The result is a floatingpoint number that is uniformly distributed in the range between 0.0 inclusive and 1.0 exclusive. It is set equal to the value associated with the argument I. 
Examples
In RAN (I), if variable I has the value 3, RAN has the value 4.8220158E05.
Description:  Returns one pseudorandom number or an array of such numbers.  
Class:  Subroutine  
Arguments:  HARVEST must be of type real. It is an INTENT(OUT) argument (see Section 5.10), and can be a scalar or an array variable. It is set to contain pseudorandom numbers from the uniform distribution within the range 0 <= x < 1. 
Examples
Consider the following:
REAL Y, Z (5, 5) ! Initialize Y with a pseudorandom number CALL RANDOM_NUMBER (HARVEST = Y) CALL RANDOM_NUMBER (Z) 
Y and Z contain uniformly distributed random numbers.
Description:  Changes or queries the seed (starting point) for the pseudorandom number generator used by RANDOM_NUMBER.  
Class:  Subroutine  
Arguments:  No more than one argument can be specified. If no argument is specified, a random number based on the date and time is assigned to the seed. The three optional arguments follow ^{1}:  
SIZE (opt)  Must be scalar and of type default integer. It is set to the number of integers (N) that the processor uses to hold the value of the seed.  
PUT (opt)  Must be a default integer array of rank one and size >= N. It is used to reset the value of the seed.  
GET (opt)  Must be a default integer array of rank one and size >= N. It is set to the current value of the seed. 
Examples
Consider the following:
CALL RANDOM_SEED ( ) ! Processor reinitializes the ! seed randomly from the date ! and time CALL RANDOM_SEED (SIZE = M) ! Sets M to N CALL RANDOM_SEED (PUT = SEED (1 : M)) ! Sets user seed CALL RANDOM_SEED (GET = OLD (1 : M)) ! Reads current seed 
Description:  Computes a pseudorandom number as a singleprecision value.  
Class:  Subroutine  
Arguments:  I1, I2  INTEGER(2) variables or array elements that contain the seed for computing the random number. These values are updated during the computation so that they contain the updated seed.  
X  A REAL(4) variable or array element where the computed random number is returned.  
Results: 
The result is returned in X, which must be of type REAL(4). The result
value is a pseudorandom number in the range 0.0 to 1.0. The algorithm
for computing the random number value is based on the values for I1 and
I2.
If I1=0 and I2=0, the generator base is set as follows: X(n + 1) = 2**16 + 3 Otherwise, it is set as follows: X(n + 1) = (2**16 + 3) * X(n) mod 2**32 The generator base X(n + 1) is stored in I1, I2. The result is X(n + 1) scaled to a real value Y(n + 1) , for 0.0 <= Y(n + 1) < 1 . 
Examples
Consider the following:
REAL X INTEGER(2) I, J ... CALL RANDU (I, J, X) 
If I and J are values 4 and 6, X stores the value 5.4932479E04.
Description:  Returns the decimal exponent range in the model representing numbers with the same kind parameter as the argument.  
Class:  Inquiry function; Generic  
Arguments:  X must be of type integer, real, or complex. It can be scalar or array valued.  
Results: 
The result is a scalar of type default integer.
For an integer argument, the result has the value INT (LOG10 ( HUGE(X) )). For information on the integer model, see Section D.1; on HUGE, see Section 9.4.56. For a real or complex argument, the result has the value INT(MIN (LOG10( HUGE(X) ), LOG10( TINY(X) ))). For information on the real model, see Section D.2; on TINY, see Section 9.4.157. 
Examples
If X is a REAL(4) value, RANGE (X) has the value 37. (HUGE(X) = ( 1  2^{24}) x 2^{128} and TINY(X) = 2^{126} .)
Description:  Converts a value to real type.  
Class:  Elemental function; Generic  
Arguments:  A  Must be of type integer, real, or complex.  
KIND (opt)  Must be a scalar integer initialization expression.  
Results: 
The result is of type real. If KIND is present, the kind parameter is
that specified by KIND. If KIND is not present, see the following table
for the kind parameter.
Functions that cause conversion of one data type to another type have the same affect as the implied conversion in assignment statements. If A is integer or real, the result is equal to an approximation of A. If A is complex, the result is equal to an approximation of the real part of A. 
Specific Name^{1}  Argument Type  Result Type 

INTEGER(1)  REAL(4)  
FLOATI  INTEGER(2)  REAL(4) 
FLOAT ^{2,3}  INTEGER(4)  REAL(4) 
REAL ^{3}  INTEGER(4)  REAL(4) 
FLOATK  INTEGER(8)  REAL(4) 
REAL(4)  REAL(4)  
SNGL ^{2,3}  REAL(8)  REAL(4) 
SNGLQ  REAL(16)  REAL(4) 
COMPLEX(4)  REAL(4)  
COMPLEX(8)  REAL(8) 
Examples
REAL (4) has the value 4.0.
REAL (Y) has the same kind parameter and value as the real part of complex variable Y.
Description:  Concatenates several copies of a string.  
Class:  Transformational function; Generic  
Arguments:  STRING  Must be scalar and of type character.  
NCOPIES  Must be scalar and of type integer. It must not be negative.  
Results:  The result is a scalar of type character and length NCOPIES x LEN(STRING). The kind parameter is the same as STRING. The value of the result is the concatenation of NCOPIES copies of STRING. 
Examples
REPEAT ( ' S ' , 3) has the value SSS.
REPEAT ( ' ABC ' , 0) has the value of a zerolength string.
Description:  Constructs an array with a different shape from the argument array.  
Class:  Transformational function; Generic  
Arguments:  SOURCE  Must be an array (of any data type). It supplies the elements for the result array. Its size must be greater than or equal to PRODUCT(SHAPE) if PAD is omitted or has size zero.  
SHAPE  Must be an integer array of up to 7 elements, with rank one and constant size. It defines the shape of the result array. Its size must be positive; its elements must not have negative values.  
PAD (opt)  Must be an array with the same type and kind parameters as SOURCE. It is used to fill in extra values if the result array is larger than SOURCE.  
ORDER (opt)  Must be an integer array with the same shape as SHAPE. Its elements must be a permutation of (1,2,...,n), where n is the size of SHAPE. If ORDER is omitted, it is assumed to be (1,2,...,n).  
Results: 
The result is an array of shape SHAPE with the same type and kind
parameters as SOURCE. The size of the result is the product of the
values of the elements of SHAPE.
In the result array, the array elements of SOURCE are placed in the order of dimensions specified by ORDER. If ORDER is omitted, the array elements are placed in normal array element order. The array elements of SOURCE are followed (if necessary) by the array elements of PAD in array element order. If necessary, additional copies of PAD follow until all the elements of the result array have values. 
Examples
RESHAPE ((/3, 4, 5, 6, 7, 8/), (/2, 3/)) has the value <left[ symbol><matrix symbol> 3&5&7<cr symbol> 4&6&8<cr symbol> <right] symbol> .
RESHAPE ((/3, 4, 5, 6, 7, 8/), (/2, 4/), (/1, 1/), (/2, 1/)) has the value <left[ symbol><matrix symbol> 3&4&5&6<cr symbol> 7&8&1&1<cr symbol> <right] symbol> .
Previous  Next  Contents  Index 