FORTRAN 77 provides a variety of intrinsic functions which may be used
in any program unit. They are subject neither to type declarations nor
IMPLICIT
statements. Their names are not reserved keywords
but to avoid confusion, it is inadvisable to use these names as arrays,
constants, variables or user-defined external subprograms. If, however, it
is desirable to use the name of an intrinsic function as the name of a
user-defined external subprogram, then the name must be declared in an
EXTERNAL
statement in the program unit which invokes it.
If an intrinsic function
appears in the actual argument list of an
external function reference or CALL
statement, then its
specific name must be declared in an
INTRINSIC
statement.
The following table outlines the generic forms of these functions.
C stands for CHARACTER
data,
D for DOUBLE PRECISION
,
I for INTEGER
,
L for LOGICAL
,
R for REAL
(single precision)
and X for COMPLEX
(single precision). Note that the MAX
and
MIN
intrinsic functions may take any number of arguments but
the rest take either one or two arguments.
Function | Argument Type | Return Type | Description |
---|---|---|---|
ABS |
X | R | modulus of a complex number |
ABS |
DIR | DIR | absolute value of a number |
ACOS |
DR | DR | arccosine of a number |
AIMAG |
X | R | imaginary part of a complex number |
AINT |
DR | DR | truncates fractional part but preserves data type |
ANINT |
DR | DR | rounds to nearest whole number but preserves data type |
ASIN |
DR | DR | arcsine of a number |
ATAN |
DR | DR | arctangent of a number |
ATAN2 |
DR,DR | DR | arctangent of arg1 divided by arg2 resolved into the correct quadrant |
CHAR |
I | C | returns nth character in character code table |
CMPLX |
DIRX | X | converts to the COMPLEX data type |
CMPLX |
DIR,DIR | X | converts to the COMPLEX data type
arg1 + i arg2 |
CONJG |
X | X | complex conjugate of a complex number |
COS |
DRX | DRX | cosine of an angle in radians |
COSH |
DR | DR | hyperbolic cosine |
DBLE |
DIRX | D | converts to the DOUBLE PRECISION data type |
DIM |
DIR,DIR | DIR | if arg1 > arg2, then returns arg1 - arg2; otherwise 0 |
DPROD |
R,R | D | double precision product of two single precision numbers |
EXP |
DRX | DRX | exponential |
ICHAR |
C | I | position of first character in string in the character code table |
INDEX |
C,C | I | searches first string and returns position of second string within it |
INT |
DIRX | I | converts to the INTEGER data type by truncation |
LEN |
C | I | length of character argument |
LGE |
C,C | L | lexical comparison; true if arg1 >= arg2 in ASCII character code |
LGT |
C,C | L | lexical comparison; true if arg1 > arg2 in ASCII character code |
LLE |
C,C | L | lexical comparison; true if arg1 <= arg2 in ASCII character code |
LLT |
C,C | L | lexical comparison; true if arg1 < arg2 in ASCII character code |
LOG |
DRX | DRX | natural logarithm |
LOG10 |
DRX | DRX | common logarithm |
MAX |
DIR,DIR,... | DIR | maximum value of arguments |
MIN |
DIR,DIR,... | DIR | minimum value of arguments |
MOD |
DIR,DIR | DIR,DIR | arg1 modulo arg2 |
NINT |
DR | I | converts to the INTEGER data type by rounding |
REAL |
X | R | real part of a complex number |
REAL |
DIR | R | converts to the REAL data type |
SIGN |
DIR,DIR | DIR | if arg2 < 0, then returns -arg1; else +arg1 |
SIN |
DRX | DRX | sine of an angle in radians |
SINH |
DR | DR | hyperbolic sine |
SQRT |
DRX | DRX | square root |
TAN |
DR | DR | tangent of an angle in radians |
TANH |
DR | DR | hyperbolic tangent |
Specific names must be used when intrinsic function names are used as
actual arguments in a procedure call. The specific name must be declared
in the INTRINSIC
statement of the calling program unit. The
following generic functions have specific names for different data types.
Generic Name | Specific Name | |||
---|---|---|---|---|
Complex | Double Precision | Integer | Real | |
ABS |
CABS |
DABS |
IABS |
ABS |
ACOS |
DACOS |
ACOS |
||
AINT |
DINT |
AINT |
||
ANINT |
DNINT |
ANINT |
||
ASIN |
DASIN |
ASIN |
||
ATAN |
DATAN |
ATAN |
||
ATAN2 |
DATAN2 |
ATAN2 |
||
COS |
CCOS |
DCOS |
COS |
|
COSH |
DCOSH |
COSH |
||
DIM |
DDIM |
IDIM |
DIM |
|
EXP |
CEXP |
DEXP |
EXP |
|
LOG |
CLOG |
DLOG |
ALOG |
|
LOG10 |
DLOG10 |
ALOG10 |
||
MOD |
DMOD |
MOD |
AMOD |
|
NINT |
IDNINT |
NINT |
||
SIGN |
DSIGN |
ISIGN |
SIGN |
|
SIN |
CSIN |
DSIN |
SIN |
|
SINH |
DSINH |
SINH |
||
SQRT |
CSQRT |
DSQRT |
SQRT |
|
TAN |
DTAN |
TAN |
||
TANH |
DTANH |
TANH |