FORTRAN Reference Manual

Intrinsic Functions
FORTRAN Reference Manual528615-001
8-3
Using Generic and Specific Function Names
Using Generic and Specific Function Names
When you reference an intrinsic function using its generic name, the function accepts
arguments of several types, and returns a value whose type corresponds to the type of
the arguments you supply when you invoke the function. For example, if you supply a
list of real values in a MAX function, MAX returns a real value; if you supply a double
precision argument in an EXP function, EXP returns a double precision value.
The generic functions which perform type conversions (CMPLX, DBLE, INT, and
REAL) are the only exception to this rule.
When you reference an intrinsic function using its specific name, for example DSIN,
the function accepts arguments of a predetermined type. For example, the function
AMAX0 selects the largest integer from its argument list and returns it as a real value.
Generic names simplify references to intrinsic functions. The generic and specific
names of some intrinsic functions are identical. However, because the compiler
replaces the generic name with the specific name that corresponds to the type of the
function’s arguments, your program always invokes the correct intrinsic function.
Because HP FORTRAN includes integer types of different sizes—INTEGER*2,
INTEGER*4, and INTEGER*8—in addition to the standard INTEGER type, all intrinsic
functions that return INTEGER according to the ANSI standard, return INTEGER*2 in
HP FORTRAN. HP FORTRAN provides analogous intrinsic functions for types
INTEGER*4 and INTEGER*8.
This section describes FORTRAN intrinsic functions. The functions are listed in
alphabetical order according to their generic type. For example, all sine routines,
including ASIN, DSIN, and so forth, are listed under the sine function.
In each function description, the generic function name is listed first in the table of
acceptable function names. Argument and function types are not specified for the
generic entry because they can be any valid type for the function. The valid types for
MIN Smallest value
MOD Remainder
NINT Nearest integer
REAL Conversion of any numeric type to real
SIGN Value after transferring a sign
SIN Sine of an angle in radians
SINH Hyperbolic sine
SQRT Square root
TAN Tangent of an angle in radians
TANH Hyperbolic tangent
Table 8-1. FORTRAN Intrinsic Functions (page 2 of 2)
Generic Function Name Description of Returned Value