HP OpenVMS Systems Documentation 
HP Fortran for OpenVMS

Previous  Contents  Index 
Description:  Produces the cotangent of X.  
Class:  Elemental function; Generic  
Arguments:  X must be of type real; it cannot be zero. It must be in radians and is treated as modulo 2*Pi sign.  
Results:  The result type is the same as X. 
Specific Name  Argument Type  Result Type 

COTAN  REAL(4)  REAL(4) 
DCOTAN  REAL(8)  REAL(8) 
QCOTAN  REAL(16)  REAL(16) 
Examples
COTAN (2.0) has the value 4.576575E01.
COTAN (0.6) has the value 1.461696.
Description:  Produces the cotangent of X.  
Class:  Elemental function; Generic  
Arguments:  X must be of type real. It must be in degrees and is treated as modulo 360.  
Results:  The result type is the same as X. 
Specific Name  Argument Type  Result Type 

COTAND  REAL(4)  REAL(4) 
DCOTAND  REAL(8)  REAL(8) 
QCOTAND  REAL(16)  REAL(16) 
Examples
COTAND (2.0) has the value 0.2863625E+02.
COTAND (0.6) has the value 0.9548947E+02.
Description:  Counts the number of true elements in an entire array or in a specified dimension of an array.  
Class:  Transformational function; Generic  
Arguments:  MASK  Must be a logical array.  
DIM (opt)  Must be a scalar integer expression with a value in the range 1 to n, where n is the rank of MASK.  
KIND (opt)  Must be a scalar integer initialization expression.  
Results: 
The result is an array or 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 is a scalar if DIM is omitted or MASK has rank one. A scalar result has a value equal to the number of true elements of MASK. If MASK has size zero, the result is zero. An array result has a rank that is one less than MASK, and shape (d _{1}, d _{2}, ..., d _{DIM1}, d _{DIM+1}, ..., d _{n}), where (d _{1}, d _{2},..., d _{n}) is the shape of MASK. Each element in an array result equals the number of elements that are true in the one dimensional array defined by MASK (s _{1}, s _{2}, ..., s _{DIM1}, :, s _{DIM+1}, ..., s _{n}). 
Examples
COUNT ((/.TRUE., .FALSE., .TRUE./)) has the value 2 because two elements are true.
COUNT ((/.TRUE., .TRUE., .TRUE./)) has the value 3 because three elements are true.
A is the array <left[ symbol><matrix symbol> 1&5&7<cr symbol> 3&6&8<cr symbol> <right] symbol> and B is the array <left[ symbol><matrix symbol> 0&5&7<cr symbol> 2&6&9<cr symbol> <right] symbol> .
COUNT (A .NE. B, DIM=1) tests to see how many elements in each column of A are not equal to the elements in the corresponding column of B. The result has the value (2, 0, 1) because:
COUNT (A .NE. B, DIM=2) tests to see how many elements in each row of A are not equal to the elements in the corresponding row of B. The result has the value (1, 2) because:
Description:  Returns a processordependent approximation of the processor time in seconds. This is a new intrinsic procedure in Fortran 95.  
Class:  Subroutine  
Arguments: 
TIME must be scalar and of type real. It is an INTENT(OUT) argument.
If a meaningful time cannot be returned, a processordependent negative value is returned. 
Examples
Consider the following:
REAL time_begin, time_end ... CALL CPU_TIME(time_begin) ... CALL CPU_TIME(time_end) PRINT (*,*) 'Time of operation was ', time_end  time_begin, ' seconds' 
Description: 
Performs a circular shift on a rankone array, or performs circular
shifts on all the complete rankone sections (vectors) along a given
dimension of an array of rank two or greater.
Elements shifted off one end are inserted at the other end. Different sections can be shifted by different amounts and in different directions. 

Class:  Transformational function; Generic  
Arguments:  ARRAY  Must be an array; it can be of any data type.  
SHIFT  Must be a scalar integer or an array with a rank that is one less than ARRAY, and shape (d _{1}, d _{2}, ..., d _{DIM1}, d _{DIM+1}, ..., d _{n}), where (d _{1}, d _{2},..., d _{n}) is the shape of ARRAY.  
DIM (opt)  Must be a scalar integer with a value in the range 1 to n, where n is the rank of ARRAY. If DIM is omitted, it is assumed to be 1.  
Results: 
The result is an array with the same type and kind parameters, and
shape as ARRAY.
If ARRAY has rank one, element i of the result is ARRAY (1 + MODULO (i + SHIFT  1, SIZE (ARRAY))). (The same shift is applied to each element.) If ARRAY has rank greater than one, each section (s _{1}, s _{2}, ..., s _{DIM1}, :, s _{DIM+1}, ..., s _{n}) of the result is shifted as follows:
The value of SHIFT determines the amount and direction of the circular shift. A positive SHIFT value causes a shift to the left (in rows) or up (in columns). A negative SHIFT value causes a shift to the right (in rows) or down (in columns). A zero SHIFT value causes no shift. 
Examples
V is the array (1, 2, 3, 4, 5, 6).
CSHIFT (V, SHIFT=2) shifts the elements in V circularly to the left by two positions, producing the value (3, 4, 5, 6, 1, 2). 1 and 2 are shifted off the beginning and inserted at the end.
CSHIFT (V, SHIFT= 2) shifts the elements in V circularly to the right by two positions, producing the value (5, 6, 1, 2, 3, 4). 5 and 6 are shifted off the end and inserted at the beginning.
M is the array <left[ symbol><matrix symbol> 1&2&3<cr symbol> 4&5&6<cr symbol> 7&8&9<cr symbol> <right] symbol> .
CSHIFT (M, SHIFT = 1, DIM = 2) produces the result <left[ symbol><matrix symbol> 2&3&1<cr symbol> 5&6&4<cr symbol> 8&9&7<cr symbol> <right] symbol> .
Each element in rows 1, 2, and 3 is shifted to the left by two positions. The elements shifted off the beginning are inserted at the end.
CSHIFT (M, SHIFT = 1, DIM = 1) produces the result <left[ symbol><matrix symbol> 7&8&9<cr symbol> 1&2&3<cr symbol> 4&5&6<cr symbol> <right] symbol> .
Each element in columns 1, 2, and 3 is shifted down by one position. The elements shifted off the end are inserted at the beginning.
CSHIFT (M, SHIFT = (/1, 1, 0/), DIM = 2) produces the result <left[ symbol><matrix symbol> 2&3&1<cr symbol> 6&4&5<cr symbol> 7&8&9<cr symbol> <right] symbol> .
Each element in row 1 is shifted to the left by one position; each element in row 2 is shifted to the right by one position; no element in row 3 is shifted at all.
Description:  Returns the current date as set within the system.  
Class:  Subroutine  
Arguments: 
BUF is a 9byte variable, array, array element, or character substring.
The date is returned as a 9byte ASCII character string taking the form ddmmmyy, where: dd is the 2digit date If BUF is of numeric type and smaller than 9 bytes, data corruption can occur. If BUF is of character type, its associated length is passed to the subroutine. If BUF is smaller than 9 bytes, the subroutine truncates the date to fit in the specified length. If an array of type character is passed, the subroutine stores the date in the first array element, using the element length, not the length of the entire array. Warning: The twodigit year return value may cause problems with the year 2000. Use DATE_AND_TIME instead (see Section 9.4.36). 
Examples
Consider the following:
CHARACTER*1 DAY(9) ... CALL DATE (DAY) 
The length of the first array element in CHARACTER array DAY is passed to the DATE subroutine. The subroutine then truncates the date to fit into the onecharacter element, producing an incorrect result.
Description:  Returns character data on the realtime clock and date in a form compatible with the representations defined in Standard ISO 8601:1988.  
Class:  Subroutine  
Arguments:  There are four optional arguments ^{1}:  
DATE (opt) 
Must be scalar and of type default character; its length must be at
least 8 to contain the complete value. Its leftmost 8 characters are
set to a value of the form CCYYMMDD, where:
CC is the century 

TIME (opt) 
Must be scalar and of type default character; its length must be at
least 10 to contain the complete value. Its leftmost 10 characters are
set to a value of the form hhmmss.sss, where:
hh is the hour of the day 

ZONE (opt)  Must be scalar and of type default character; its length must be at least 5 to contain the complete value. Its leftmost 5 characters are set to a value of the form <pm symbol> hhmm, where hh and mm are the time difference with respect to Coordinated Universal Time (UTC) ^{2} in hours and parts of an hour expressed in minutes, respectively.  
VALUES
(opt) 
Must be of type default integer and of rank one. Its size must be at
least 8. The values returned in VALUES are as follows:
VALUES (1) is the 4digit year. 
Note: If time zone information is not available on the system, a blank is returned for the ZONE argument and 1 is returned for the differential element of the VALUES argument.
Examples
Consider the following example executed on 2000 March 28 at 11:04:14.5:
INTEGER DATE_TIME (8) CHARACTER (LEN = 12) REAL_CLOCK (3) CALL DATE_AND_TIME (REAL_CLOCK (1), REAL_CLOCK (2), & REAL_CLOCK (3), DATE_TIME) 
This assigns the value "20000328" to REAL_CLOCK (1), the value "110414.500" to REAL_CLOCK (2), and the value "0500" to REAL_CLOCK (3). The following values are assigned to DATE_TIME: 2000, 3, 28, 300, 11, 4, 14, and 500.
Description:  Converts a number to doubleprecision real type.  
Class:  Elemental function; Generic  
Arguments:  A must be of type integer, real, or complex.  
Results: 
The result is of type double precision real (REAL(8)
or REAL*8).
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 double precision, the result is the value of the A with no conversion (DBLE(A) = A). If A is of type integer or real, the result has as much precision of the significant part of A as a double precision 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 double precision value can contain. 
Specific Name^{1}  Argument Type  Result Type 

INTEGER(1)  REAL(8)  
INTEGER(2)  REAL(8)  
INTEGER(4)  REAL(8)  
INTEGER(8)  REAL(8)  
DBLE ^{2 }  REAL(4)  REAL(8) 
REAL(8)  REAL(8)  
DBLEQ  REAL(16)  REAL(8) 
COMPLEX(4)  REAL(8)  
COMPLEX(8)  REAL(8)  
COMPLEX(16)  REAL(8) 
Examples
DBLE (4) has the value 4.0.
DBLE ((3.4, 2.0)) has the value 3.4.
Description:  Converts the argument to double complex 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 double complex (COMPLEX(8) or COMPLEX*16).
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. DCMPLX(X, Y) has the complex value whose real part is REAL(X, KIND=8) and whose imaginary part is REAL(Y, KIND=8). 
Examples
DCMPLX (3) has the value (3.0, 0.0).
DCMPLX (4.1, 2.3) has the value (4.1, 2.3).
Description:  Converts an integer to doubleprecision type.  
Class:  Elemental function; Generic  
Arguments:  A must be of type integer.  
Results: 
The result is of type doubleprecision real (REAL(8) or REAL*8).
Functions that cause conversion of one data type to another type have the same affect as the implied conversion in assignment statements. 
Specific Name^{1}  Argument Type  Result Type 

INTEGER(1)  REAL(8)  
DFLOTI  INTEGER(2)  REAL(8) 
DFLOTJ  INTEGER(4)  REAL(8) 
DFLOTK  INTEGER(8)  REAL(8) 
Examples
DFLOAT (4) has the value 4.0.
Previous  Next  Contents  Index 