FORTRAN 77 Language Reference

Chapter 6 Intrinsic Functions

This chapter tabulates and explains the set of intrinsic functions that are part of Sun FORTRAN 77. (For information about Fortran library routines, see the Fortran Library Reference.)

Intrinsic functions that are Sun extensions of the ANSI FORTRAN 77 standard are marked with @.

Intrinsic functions have generic and specific names when they accept arguments of more than one data type. In general, the generic name returns a value with the same data type as its argument. However, there are exceptions such as the type conversion functions (Table 6-2) and the inquiry functions (Table 6-7). The function may also be called by one of its specific names to handle a specific argument data type.

With functions that work on more than one data item (e.g. sign(a1,a2) ), all the data arguments must be the same type.

In the following tables, the FORTRAN 77 intrinsic functions are listed by:


Note -

Compiler options -dbl, -i2, -r8, and -xtypemap change the default sizes of variables and have an effect on intrinsic references. See "Remarks", and the discussion of default sizes and alignment in "Size and Alignment of Data Types ".


Arithmetic and Mathematical Functions

This section details arithmetic, type conversion, trigonometric, and other functions. "a" stands for a function's single argument, "a1" and "a2" for the first and second arguments of a two argument function, and "ar" and "ai" for the real and imaginary parts of a function's complex argument.

Note that REAL*16 and COMPLEX*32 are SPARC only.

Arithmetic

Table 6-1 Arithmetic Functions

Intrinsic Function 

Definition 

No. of 

Args. 

Generic 

Name 

Specific 

Names 

Argument 

Type 

Function Type 

Absolute value 

See Note (6).

|a| = 

 

(ar**2+ai**2)**.5 

ABSIABS ABS DABS CABS QABS @ ZABS @ CDABS @ CQABS @INTEGER REAL DOUBLE COMPLEX REAL*16 DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32INTEGER REAL DOUBLE REAL REAL*16 DOUBLE DOUBLE REAL*16

Truncation 

See Note (1).

int(a) 

 

 1AINTAINT DINT QINT @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Nearest whole number 

int(a+.5) if a 0­­­­ 

int(a-.5) if a < 0 

 1ANINTANINT DNINT QNINT @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Nearest integer 

int(a+.5) if a 0 

int(a-.5) if a < 0 

 1NINTNINT IDNINT IQNINT @REAL DOUBLE REAL*16INTEGER INTEGER INTEGER

Remainder 

See Note (1).

a1-int(a1/a2)*a2 

MODMOD AMOD DMOD QMOD @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

Transfer of sign 

|a1| if a2 0 

-|a1| if a2 < 0 

SIGNISIGN SIGN DSIGN QSIGN @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

Positive difference 

a1-a2 if a1 > a2 

0 if a1 £ a2

DIMIDIM DIM DDIM QDIM @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

Double and quad products 

a1 * a2 

 -DPROD QPROD @REAL DOUBLEDOUBLE REAL*16

Choosing largest value 

max(a1, a2, ...) 

MAX MAX0 AMAX1 DMAX1 QMAX1 @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

 

 

 

AMAX0AMAX0INTEGERREAL

 

 

 

MAX1MAX1REALINTEGER

Choosing smallest value 

min(a1, a2, ...) 

MIN MIN0 AMIN1 DMIN1 QMIN1 @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

 

 

 

AMIN0AMIN0INTEGERREAL

 

 

 

MIN1MIN1REALINTEGER

Type Conversion

Table 6-2 Type Conversion Functions

Conversion to 

No. of Args 

Generic Name 

Specific  

Names 

Argument Type 

Function Type 

INTEGER See Note (1).

INT- INT IFIX IDINT - - - IQINT @INTEGER REAL REAL DOUBLE COMPLEX COMPLEX*16 COMPLEX*32 REAL*16INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER
REAL See Note (2).

REALREAL FLOAT - SNGL SNGLQ @ - - -INTEGER INTEGER REAL DOUBLE REAL*16 COMPLEX COMPLEX*16 COMPLEX*32REAL REAL REAL REAL REAL REAL REAL REAL
DOUBLE See Note (3).

DBLEDBLE DFLOAT DREAL @ DBLEQ @ - - - -INTEGER INTEGER REAL DOUBLE REAL*16 COMPLEX COMPLEX*16 COMPLEX*32DOUBLE PRECISION DOUBLE PRECISION DOUBLE PRECISION DOUBLE PRECISION DOUBLE PRECISION DOUBLE PRECISION DOUBLE PRECISION DOUBLE PRECISION
REAL*16 See Note (3').

QREAL@ QEXT @QREAL @ QFLOAT @ - QEXT @ QEXTD @ - - - -INTEGER INTEGER REAL INTEGER DOUBLE REAL*16 COMPLEX COMPLEX*16 COMPLEX*32REAL*16 REAL*16 REAL*16 REAL*16 REAL*16 REAL*16 REAL*16 REAL*16 REAL*16
COMPLEX See Notes (4) and (8).

1 or 2 

CMPLX- - - - - - -INTEGER REAL DOUBLE REAL*16 COMPLEX COMPLEX*16 COMPLEX*32COMPLEX COMPLEX COMPLEX COMPLEX COMPLEX COMPLEX COMPLEX
DOUBLE COMPLEX See Note (8).

1 or 2 

DCMPLX@- - - - - - -INTEGER REAL DOUBLE REAL*16 COMPLEX COMPLEX*16 COMPLEX*32DOUBLE COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX
COMPLEX*32 See Note (8).

1 or 2 

QCMPLX@- - - - - - -INTEGER REAL DOUBLE REAL*16 COMPLEX COMPLEX*16 COMPLEX*32COMPLEX*32 COMPLEX*32 COMPLEX*32 COMPLEX*32 COMPLEX*32 COMPLEX*32 COMPLEX*32
INTEGER See Note (5).

 - -ICHAR IACHAR @CHARACTERINTEGER
CHARACTER See Note (5).

 - -CHAR ACHAR @INTEGERCHARACTER

On an ASCII machine, including Sun systems:

On a non-ASCII machine, ACHAR and IACHAR were intended to provide a way to deal directly with ASCII.

Trigonometric Functions

Table 6-3 Trigonometric Functions

Intrinsic Function 

Definition 

Args 

Generic Name 

Specific  

Names 

Argument Type 

Function Type 

Sine 

See Note (7).

sin(a) 

SINSIN DSIN QSIN @ CSIN ZSIN @ CDSIN @ CQSIN @REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32

Sine (degrees) 

See Note (7).

sin(a) 

SIND @SIND @ DSIND @ QSIND @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Cosine 

See Note (7).

cos(a) 

COSCOS DCOS QCOS @ CCOS ZCOS @ CDCOS @ CQCOS @REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32

Cosine (degrees) 

See Note (7).

cos(a) 

COSD @COSD @ DCOSD @ QCOSD @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Tangent 

See Note (7).

tan(a) 

TANTAN DTAN QTAN @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Tangent (degrees) 

See Note (7).

tan(a) 

TAND @TAND @ DTAND @ QTAND @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Arcsine 

See Note (7).

arcsin(a) 

ASINASIN DASIN QASIN @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Arcsine (degrees) 

See Note (7).

arcsin(a) 

ASIND @ASIND @ DASIND @ QASIND @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Arccosine 

See Note (7).

arccos(a) 

ACOSACOS DACOS QACOS @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Arccosine (degrees) 

See Note (7).

arccos(a) 

ACOSD @ACOSD @ DACOSD @ QACOSD @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Arctangent 

See Note (7).

arctan(a) 

ATANATAN DATAN QATAN @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

arctan 

(a1/a2) 

ATAN2ATAN2 DATAN2 QATAN2 @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Arctangent (degrees) 

See Note (7).

arctan(a) 

ATAND @ATAND @ DATAND @ QATAND @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

arctan 

(a1/a2) 

ATAN2D@ATAN2D @ DATAN2D @ QATAN2D @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Hyperbolic Sine 

See Note (7).

sinh(a) 

SINHSINH DSINH QSINH @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Hyperbolic Cosine 

See Note (7).

cosh(a) 

COSHCOSH DCOSH QCOSH @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Hyperbolic Tangent 

See Note (7).

tanh(a) 

TANHTANH DTANH QTANH @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Other Mathematical Functions

Table 6-4 Other Mathematical Functions

Intrinsic Function 

Definition 

No. of Args. 

Generic Name 

Specific Names 

Argument Type 

Function Type 

Imaginary part of a complex number 

See Note (6).

ai 

IMAGAIMAG DIMAG @ QIMAG @COMPLEX DOUBLE COMPLEX COMPLEX*32REAL DOUBLE REAL*16

Conjugate of a complex number 

See Note (6).

(ar, -ai) 

CONJGCONJG DCONJG @ QCONJG @COMPLEX DOUBLE COMPLEX COMPLEX*32COMPLEX DOUBLE COMPLEX COMPLEX*32

Square root 

a**(1/2) 

SQRTSQRT DSQRT QSQRT @ CSQRT ZSQRT @ CDSQRT @ CQSQRT @REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32

Cube root 

See Note(8').

a**(1/3) 

CBRTCBRT @ DCBRT @ QCBRT @ CCBRT @ ZCBRT @ CDCBRT @ CQCBRT @REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32

Exponential 

e**a 

EXPEXP DEXP QEXP @ CEXP ZEXP @ CDEXP @ CQEXP @REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32

Natural logarithm 

log(a) 

LOGALOG DLOG QLOG @ CLOG ZLOG @ CDLOG @ CQLOG @REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32REAL DOUBLE REAL*16 COMPLEX DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32

Common logarithm 

log10(a) 

LOG10ALOG10 DLOG10 QLOG10 @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Error function (See note below)

erf(a) 

ERFERF @ DERF @REAL DOUBLEREAL DOUBLE

Error function 

1.0 - erf(a) 

ERFCERFC @ DERFC @REAL DOUBLEREAL DOUBLE

Character Functions

Table 6-5 Character Functions

Intrinsic Function 

Definition 

No. of Args. 

Specific 

Names 

Argument Type 

Function Type 

Conversion See Note (5).

Conversion to character 

Conversion to integer 

See also:

Table 6-2.

 

CHAR ACHAR @ ICHAR IACHAR @ INTEGER CHARACTERCHARACTER INTEGER

Index of a substring 

Location of substring a2 in string a1  

See Note (10).

INDEXCHARACTERINTEGER

Length 

Length of character entity  

See Note (11).

LENCHARACTERINTEGER

Lexically greater than or equal  

a1 a2 

See Note (12).

LGECHARACTERLOGICAL

Lexically greater than 

a1 > a2 

See Note (12).

LGTCHARACTERLOGICAL

Lexically less than or equal  

a1 £ a2

See Note (12).

LLECHARACTERLOGICAL

Lexically less than 

a1 < a2 

See Note (12).

LLTCHARACTERLOGICAL

On an ASCII machine (including Sun systems):

On a non-ASCII machine, ACHAR and IACHAR were intended to provide a way to deal directly with ASCII.

Miscellaneous Functions

Other miscellaneous functions include bitwise functions, environmental inquiry functions, and memory allocation and deallocation functions.

Bit Manipulation @

None of these functions are part of the FORTRAN 77 Standard.

Table 6-6 Bitwise Functions

Bitwise Operations 

No. of Args. 

Specific Name 

Argument Type 

Function Type 

Complement 

NOT INTEGERINTEGER

And 

2 2 

AND IAND INTEGER INTEGERINTEGER INTEGER

Inclusive or 

2 2 

OR IOR INTEGER INTEGERINTEGER INTEGER

Exclusive or 

2 2 

XOR IEOR INTEGER INTEGERINTEGER INTEGER

Shift See Note (14).

ISHFT INTEGERINTEGER

Left shift See Note (14).

LSHIFT INTEGERINTEGER

Right shift See Note (14).

RSHIFT INTEGERINTEGER

Logical right shift See Note (14).

LRSHFT INTEGERINTEGER

Circular shift 

ISHFTC INTEGERINTEGER

Bit extraction 

IBITS INTEGERINTEGER

Bit set 

IBSET INTEGERINTEGER

Bit test 

BTEST INTEGERLOGICAL

Bit clear 

IBCLR INTEGERINTEGER

The above functions are available as intrinsic or extrinsic functions. See also the discussion of the library bit manipulation routines in the Fortran Library Reference manual.

Environmental Inquiry Functions @

None of these functions are part of the FORTRAN 77 Standard.

Table 6-7 Environmental Inquiry Functions

Definition 

No. of Args. 

Generic Name 

Argument Type 

Function Type 

Base of Number System 

EPBASE INTEGER REAL DOUBLE REAL*16INTEGER INTEGER INTEGER INTEGER

Number of Significant Bits 

EPPREC INTEGER REAL DOUBLE REAL*16INTEGER INTEGER INTEGER INTEGER

Minimum Exponent 

EPEMIN REAL DOUBLE REAL*16INTEGER INTEGER INTEGER

Maximum Exponent 

EPEMAX REAL DOUBLE REAL*16INTEGER INTEGER INTEGER

Least Nonzero Number 

EPTINY REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Largest Number Representable 

EPHUGE INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

Epsilon See Note (16).

EPMRSP REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Memory @

None of these functions are part of the FORTRAN 77 Standard.

Table 6-8 Memory Functions

Intrinsic Function 

Definition 

No. of Args 

Specific Name 

Argument Type 

Function Type 

Location 

Address of 

See Note (17).

LOC AnyINTEGER*4 INTEGER*8

Allocate 

Allocate memory and return address. 

See Note (17).

MALLOC MALLOC64 INTEGER*4 INTEGER*8INTEGER INTEGER*8

Deallocate 

Deallocate memory allocated by MALLOC. See Note (17).

FREE Any -

Size 

Return the size of the argument in bytes. 

See Note (18).

SIZEOF

Any expression

INTEGER

Although malloc and free are not, strictly speaking, intrinsics, they are listed here and in the Fortran Library Reference.

Remarks

The following remarks apply to all of the intrinsic function tables in this chapter.

Notes on Functions

Tables and notes 1 through 12 are based on the "Table of Intrinsic Functions," from ANSI X3.9-1978 Programming Language FORTRAN, with the FORTRAN extensions added.

(1) INT

If A is type integer, then INT(A) is A.

If A is type real or double precision, then:

if |A| < 1, then INT(A) is 0 if |A| 1, then INT(A) is the greatest integer that does not exceed the magnitude of A, and whose sign is the same as the sign of A. (Such a mathematical integer value may be too large to fit in the computer integer type.)

If A is type complex or double complex, then apply the above rule to the real part of A.

If A is type real, then IFIX(A) is the same as INT(A).

(2) REAL

If A is type real, then REAL(A) is A.

If A is type integer or double precision, then REAL(A) is as much precision of the significant part of A as a real datum can contain.

If A is type complex, then REAL(A) is the real part of A.

If A is type double complex, then REAL(A) is as much precision of the significant part of the real part of A as a real datum can contain.

(3) DBLE

If A is type double precision, then DBLE(A) is A.

If A is type integer or real, then DBLE(A) is as much precision of the significant part of A as a double precision datum can contain.

If A is type complex, then DBLE(A) is as much precision of the significant part of the real part of A as a double precision datum can contain.

If A is type COMPLEX*16, then DBLE(A) is the real part of A.

(3') QREAL

If A is type REAL*16, then QREAL(A) is A.

If A is type integer, real, or double precision, then QREAL(A) is as much precision of the significant part of A as a REAL*16 datum can contain.

If A is type complex or double complex, then QREAL(A) is as much precision of the significant part of the real part of A as a REAL*16 datum can contain.

If A is type COMPLEX*16 or COMPLEX*32, then QREAL(A) is the real part of A.

(4) CMPLX

If A is type complex, then CMPLX(A) is A.

If A is type integer, real, or double precision, then CMPLX(A) is REAL(A) + 0i.

If A1 and A2 are type integer, real, or double precision, then CMPLX(A1,A2) is REAL(A1) + REAL(A2)*i.

If A is type double complex, then CMPLX(A) is REAL( DBLE(A) ) + i*REAL( DIMAG(A) ).

If CMPLX has two arguments, then they must be of the same type, and they may be one of integer, real, or double precision.

If CMPLX has one argument, then it may be one of integer, real, double precision, complex, COMPLEX*16, or COMPLEX*32.

(4') DCMPLX

If A is type COMPLEX*16, then DCMPLX(A) is A.

If A is type integer, real, or double precision, then DCMPLX(A) is DBLE(A) + 0i.

If A1 and A2 are type integer, real, or double precision, then DCMPLX(A1,A2) is DBLE(A1) + DBLE(A2)*i.

If DCMPLX has two arguments, then they must be of the same type, and they may be one of integer, real, or double precision.

If DCMPLX has one argument, then it may be one of integer, real, double precision, complex, COMPLEX*16, or COMPLEX*32.

(5) ICHAR

ICHAR(A) is the position of A in the collating sequence.

The first position is 0, the last is N-1, 0£ICHAR(A)£N-1, where N is the number of characters in the collating sequence, and A is of type character of length one.

CHAR and ICHAR are inverses in the following sense:

(6) COMPLEX

A COMPLEX value is expressed as an ordered pair of reals, (ar, ai), where ar is the real part, and ai is the imaginary part.

(7) Radians

All angles are expressed in radians, unless the "Intrinsic Function" column includes the "(degrees)" remark.

(8) COMPLEX Function

The result of a function of type COMPLEX is the principal value.

(8') CBRT

If a is of COMPLEX type, CBRT results in COMPLEX RT1=(A, B), where: A>= 0.0, and -60 degrees <= arctan (B/A) < + 60 degrees.

Other two possible results can be evaluated as follows:

(9) Argument types

All arguments in an intrinsic function reference must be of the same type.

(10) INDEX

INDEX(X,Y) is the place in X where Y starts. That is, it is the starting position within character string X of the first occurrence of character string Y.

If Y does not occur in X, then INDEX(X,Y) is 0.

If LEN(X) < LEN(Y), then INDEX(X,Y) is 0.

INDEX returns default INTEGER*4 data. If compiling for a 64-bit environment, the compiler will issue a warning if the result overflows the INTEGER*4 data range. To use INDEX in a 64-bit environment with character strings larger than the INTEGER*4 limit (2 Gbytes), the INDEX function and the variables receiving the result must be declared INTEGER*8.

(11) LEN

LEN returns the declared length of the CHARACTER argument variable. The actual value of the argument is of no importance.

LEN returns default INTEGER*4 data. If compiling for a 64-bit environment, the compiler will issue a warning if the result overflows the INTEGER*4 data range. To use LEN in a 64-bit environment with character variables larger than the INTEGER*4 limit (2 Gbytes), the LEN function and the variables receiving the result must be declared INTEGER*8.

(12) Lexical Compare

LGE( X, Y ) is true if X=Y, or if X follows Y in the collating sequence; otherwise, it is false.

LGT( X, Y ) is true if X follows Y in the collating sequence; otherwise, it is false.

LLE( X, Y ) is true if X=Y, or if X precedes Y in the collating sequence; otherwise, it is false.

LLT( X, Y ) is true if X precedes Y in the collating sequence; otherwise, it is false.

If the operands for LGE, LGT, LLE, and LLT are of unequal length, the shorter operand is considered as if it were extended on the right with blanks.

(13) Bit Functions

See Appendix D, VMS Language Extensions for details on other bitwise operations.

(14) Shift

LSHIFT shifts a1 logically left by a2 bits (inline code).

LRSHFT shifts a1 logically right by a2 bits (inline code).

RSHIFT shifts a1 arithmetically right by a2 bits.

ISHFT shifts a1 logically left if a2 > 0 and right if a2 < 0.

The LSHIFT and RSHIFT functions are the FORTRAN analogs of the C << and >> operators. As in C, the semantics depend on the hardware.

The behavior of the shift functions with an out of range shift count is hardware dependent and generally unpredictable. In this release, shift counts larger than 31 result in hardware dependent behavior.

(15) Environmental inquiries

Only the type of the argument is significant.

(16) Epsilon

Epsilon is the least e, such that 1.0 + e 1.0.

(17) LOC, MALLOC, and FREE

The LOC function returns the address of a variable or of an external procedure. The function call MALLOC( n ) allocates a block of at least n bytes, and returns the address of that block.

LOC returns default INTEGER*4 in 32-bit environments, INTEGER*8 in 64-bit environments.

MALLOC is a library function and not an intrinsic. It too returns default INTEGER*4 in 32-bit environments, INTEGER*8 in 64-bit environments. However, MALLOC must be explicitly declared INTEGER*8 when compiling for 64-bit environments.

The value returned by LOC or MALLOC should be stored in variables typed POINTER, INTEGER*4, or INTEGER*8 in 64-bit environments. The argument to FREE must be the value returned by a previous call to MALLOC and hence should have data type POINTER, INTEGER*4, or INTEGER*8.

MALLOC64 always takes an INTEGER*8 argument (size of memory request in bytes) and always returns an INTEGER*8 value. Use this routine rather than MALLOC when compiling programs that must run in both 32-bit and 64-bit environments. The receiving variable must be declared either POINTER or INTEGER*8.

(18) SIZEOF

The SIZEOF intrinsic cannot be applied to arrays of an assumed size, characters of a length that is passed, or subroutine calls or names. SIZEOF returns default INTEGER*4 data. If compiling for a 64-bit environment, the compiler will issue a warning if the result overflows the INTEGER*4 data range. To use SIZEOF in a 64-bit environment with arrays larger than the INTEGER*4 limit (2 Gbytes), the SIZEOF function and the variables receiving the result must be declared INTEGER*8.

VMS Intrinsic Functions

This section lists VMS FORTRAN intrinsic routines recognized by f77. They are, of course, nonstandard. @

VMS Double-Precision Complex

Table 6-9 VMS Double-Precision Complex Functions

Generic Name 

Specific Names 

Function 

Argument Type 

Result Type 

 CDABS CDEXP CDLOG CDSQRT

Absolute value 

Exponential, e**a

Natural log 

Square root 

COMPLEX*16 COMPLEX*16 COMPLEX*16 COMPLEX*16REAL*8 COMPLEX*16 COMPLEX*16 COMPLEX*16
 CDSIN CDCOS

Sine 

Cosine 

COMPLEX*16 COMPLEX*16COMPLEX*16 COMPLEX*16
DCMPLXDCONJG DIMAG DREAL

Convert to DOUBLE COMPLEX

Complex conjugate 

Imaginary part of complex 

Real part of complex 

Any numeric COMPLEX*16 COMPLEX*16 COMPLEX*16COMPLEX*16 COMPLEX*16 REAL*8 REAL*8

VMS Degree-Based Trigonometric

Table 6-10 VMS Degree-Based Trigonometric Functions

Generic Name 

Specific Names 

Function 

Argument Type 

Result Type 

SIND SIND DSIND QSIND

Sine  

 

- REAL*4 REAL*8 REAL*16- REAL*4 REAL*8 REAL*16
COSDCOSD DCOSD QCOSD

Cosine  

 

- REAL*4 REAL*8 REAL*16- REAL*4 REAL*8 REAL*16
TAND TAND DTAND QTAND

Tangent  

 

- REAL*4 REAL*8 REAL*16- REAL*4 REAL*8 REAL*16
ASIND ASIND DASIND QASIND

Arc sine  

 

- REAL*4 REAL*8 REAL*16- REAL*4 REAL*8 REAL*16
ACOSD ACOSD DACOSD QACOSD

Arc cosine  

 

- REAL*4 REAL*8 REAL*16- REAL*4 REAL*8 REAL*16
ATAND ATAND DATAND QATAND

Arc tangent  

 

- REAL*4 REAL*8 REAL*16- REAL*4 REAL*8 REAL*16
ATAN2D ATAN2D DATAN2D QATAN2D

Arc tangent of a1/a2  

 

- REAL*4 REAL*8 REAL*16- REAL*4 REAL*8 REAL*16

VMS Bit-Manipulation

Table 6-11 VMS Bit-Manipulation Functions

Generic Name 

Specific Names 

Function 

Argument Type 

Result Type 

IBITS IIBITS JIBITS

From a1, initial bit a2, extract a3 bits

 

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4
ISHFT IISHFT JISHFT

Shift a1 logically by a2 bits; if a2 positive shift left, if a2 negative shift right

Shift a1 logically left by a2 bits

Shift a1 logically left by a2 bits

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4
ISHFTC IISHFTC JISHFTC

In a1, circular shift by a2 places, of right a3 bits

 

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4
IAND IIAND JIAND

Bitwise AND of a1, a2

 

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4
IOR IIOR JIOR

Bitwise OR of a1, a2

 

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4
IEOR IIEOR JIEOR

Bitwise exclusive OR of a1, a2

 

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4
NOT INOT JNOT

Bitwise complement 

 

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4
IBSET IIBSET JIBSET

In a1, set bit a2 to 1

In a1, set bit a2 to 1; return new a1

In a1, set bit a2 to 1; return new a1

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4
BTEST BITEST BJTEST

If bit a2 of a1 is 1, return .TRUE.

 

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4
IBCLR IIBCLR JIBCLR

In a1, set bit a2 to 0; return new a1

 

- INTEGER*2 INTEGER*4- INTEGER*2 INTEGER*4

VMS Multiple Integer Types

The possibility of multiple integer types is not addressed by the FORTRAN Standard. f77 copes with their existence by treating a specific INTEGER-to-INTEGER function name (IABS, and so forth) as a special sort of generic. The argument type is used to select the appropriate runtime routine name, which is not accessible to the programmer.

VMS FORTRAN takes a similar approach, but makes the specific names available.

Table 6-12 VMS Integer Functions

Specific Names 

Function 

Argument Type 

Result Type  

IIABS JIABS

Absolute value 

Absolute value 

INTEGER*2 INTEGER*4INTEGER*2 INTEGER*4
IMAX0 JMAX0

Maximum [There must be at least two arguments.]

Maximum 1

INTEGER*2 INTEGER*4INTEGER*2 INTEGER*4
IMIN0 JMIN0

Minimum 1

Minimum 1

INTEGER*2 INTEGER*4INTEGER*2 INTEGER*4
IIDIM JIDIM

Positive difference [The positive difference is: a1-min(a1,a2))]

Positive difference 2

INTEGER*2 INTEGER*4INTEGER*2 INTEGER*4
IMOD JMOD

Remainder of a1/a2 

Remainder of a1/a2 

INTEGER*2 INTEGER*4INTEGER*2 INTEGER*4
IISIGN JISIGN

Transfer of sign, |a1|* sign(a2) 

Transfer of sign, |a1|* sign(a2) 

INTEGER*2 INTEGER*4INTEGER*2 INTEGER*4

Functions Coerced to a Particular Type

Some VMS FORTRAN functions coerce to a particular INTEGER type.

Table 6-13 Translated Functions that VMS Coerces to a Particular Type

Specific Names 

Function 

Argument Type 

Result Type  

IINT JINT

Truncation toward zero 

Truncation toward zero 

REAL*4 REAL*4INTEGER*2 INTEGER*4
IIDINT JIDINT

Truncation toward zero 

Truncation toward zero 

REAL*8 REAL*8INTEGER*2 INTEGER*4
IIQINT JIQINT

Truncation toward zero 

Truncation toward zero 

REAL*16 REAL*16INTEGER*2 INTEGER*4
ININT JNINT

Nearest integer, INT(a+.5*sign(a))

Nearest integer, INT(a+.5*sign(a))

REAL*4 REAL*4INTEGER*2 INTEGER*4
IIDNNT JIDNNT

Nearest integer, INT(a+.5*sign(a))

Nearest integer, INT(a+.5*sign(a))

REAL*8 REAL*8INTEGER*2 INTEGER*4
IIQNNT JIQNNT

Nearest integer, INT(a+.5*sign(a))

Nearest integer, INT(a+.5*sign(a))

REAL*16 REAL*16INTEGER*2 INTEGER*4
IIFIX JIFIX

Fix 

Fix 

REAL*4 REAL*4INTEGER*2 INTEGER*4
IMAX1(a,a2,...) JMAX1(a,a2,...)

Maximum of two or more arguments 

Maximum of two or more arguments 

REAL*4 REAL*4INTEGER*2 INTEGER*4
IMIN1(a,a2,... JMIN1(a,a2,...

Minimum of two or more arguments 

Minimum of two or more arguments 

READ*4 READ*4INTEGER*2 INTEGER*4

Functions Translated to a Generic Name

In some cases, each VMS-specific name is translated into an f77 generic name.

Table 6-14 VMS Functions That Are Translated into f77 Generic Names

Specific Names 

Function 

Argument Type 

Result Type 

FLOATI FLOATJ

Convert to REAL*4

Convert to REAL*4

INTEGER*2 INTEGER*4REAL*4 REAL*4
DFLOTI DFLOTJ

Convert to REAL*8

Convert to REAL*8

INTEGER*2 INTEGER*4REAL*8 REAL*8
AIMAX0 AJMAX0

Maximum 

Maximum 

INTEGER*2 INTEGER*4REAL*4 REAL*4
AIMIN0 AJMIN0

Minimum 

Minimum 

INTEGER*2 INTEGER*4REAL*4 REAL*4

Zero Extend

The following zero-extend functions are recognized by f77. The first unused high-order bit is set to zero and extended toward the higher-order end to the width indicated in the table

Table 6-15 Zero-Extend Functions

Generic Name 

Specific Names 

Function 

Argument Type 

Result Type  

ZEXT 

Zero-extend 

-

-

 IZEXT

Zero-extend 

BYTE LOGICAL*1 LOGICAL*2 INTEGER*2INTEGER*2
 JZEXT

Zero-extend 

BYTE LOGICAL*1 LOGICAL*2 LOGICAL*4 INTEGER INTEGER*2 INTEGER*4INTEGER*4