Navigation: Previous   Up   Next

8.4 Fortran 95 Intrinsic Procedures

This section provides a quick reference guide to the Fortran 90/95 intrinsic functions and subroutines.

Procedures marked with ‘*’ are non-generic versions of other intrinsics. Procedures marked with ‘E’ are elemental.

Procedures marked with ‘I’ are inquiry functions; these query characteristics of a variable other than its value.

Procedures marked with ‘P’ may be supplied as actual procedure arguments; when it is used as a procedure argument all arguments are scalar, no optional arguments are allowed, and it is not generic: if the name is normally generic the procedure argument version is default INTEGER if it begins with the letter I to N, and default REAL otherwise.

Arguments named ‘KIND’ must be initialisation expressions.

Arguments printed in italics (e.g., ‘DIM’) are optional.

Intrinsic Functions

Function Name Flags Description
ABS(A) EP Absolute value.
ACHAR(I) E Produce character from ASCII value.
ACOS(X) EP Arccosine.
ADJUSTL(STRING) E Adjust string to the left by moving leading blanks to the end.
ADJUSTR(STRING) E Adjust string to the right.
AIMAG(Z) EP The imaginary part of a complex number.
AINT(A,KIND ) EP Truncate to a whole number.
ALL(MASK,DIM) Reduce MASK with the .AND. operation.
ALLOCATED(ARRAY) I Whether an allocatable array is allocated.
ALOG(X) *P LOG function restricted to scalar default real.
ALOG10(X) *P LOG10 function restricted to scalar default real.
AMAX0(A1,A2,A3,...) * REAL(MAX(A1,A2,A3,...)) with scalar default integer args.
AMAX1(A1,A2,A3,...) * MAX function restricted to scalar default real.
AMIN0(A1,A2,A3,...) * REAL(MIN(A1,A2,A3,...)) with scalar default integer args.
AMIN1(A1,A2,A3,...) * MIN function restricted to scalar default integer.
AMOD(A,P) *P MOD function restricted to scalar default real.
ANINT(A,KIND) EP Round to a whole number.
ANY(MASK,DIM) Reduce MASK with the .OR. operation.
ASIN(X) EP Arcsine.
ASSOCIATED(POINTER,TARGET) I Whether a pointer is associated with a target.
ATAN(X) EP Arctangent.
ATAN2(Y,X) EP Arctangent.
BIT_SIZE(I) Number of bits in an integer type.
BTEST(I,POS) E Whether a particular bit is 1.
CABS(A) *P ABS function restricted to scalar default complex.
CCOS(X) *P COS function restricted to scalar default complex.
CEILING(A,KIND) E Smallest integer greater than or equal to A.
CEXP(X) *P EXP function restricted to scalar default complex.
CHAR(I,KIND) E Produce character from native coded character set value.
CLOG(X) *P LOG function restricted to scalar default complex.
CMPLX(X,Y,KIND) E Convert to complex.
CONJG(Z) EP Complex conjugate.
COS(X) EP Cosine.
COSH(X) EP Hyperbolic cosine.
COUNT(MASK,DIM) Reduce MASK by counting .TRUE. elements.
CSHIFT(ARRAY,SHIFT,DIM) Circular shift of an array.
CSIN(X) *P SIN function restricted to scalar default complex.
CSQRT(X) *P SQRT function restricted to scalar default complex.
DABS(A) *P ABS function restricted to scalar double precision.
DACOS(X) *P ACOS function restricted to scalar double precision.
DASIN(X) *P ASIN function restricted to scalar double precision.
DATAN(X) *P ATAN function restricted to scalar double precision.
DATAN2(Y,X) *P ATAN2 function restricted to scalar double precision.
DBLE(A) E Convert to double precision.
DCOS(X) *P COS function restricted to scalar double precision.
DCOSH(X) *P COSH function restricted to scalar double precision.
DDIM(X,Y) *P DIM function restricted to scalar double precision.
DEXP(X) *P EXP function restricted to scalar double precision.
DIGITS(X) I Number of mantissa digits in the model for X.
DIM(X,Y) EP Non-negative difference, MAX(0,X-Y).
DINT(A) *P AINT function restricted to scalar double precision.
DLOG(X) *P LOG function restricted to scalar double precision.
DLOG10(X) *P LOG10 function restricted to scalar double precision.
DMAX1(A1,A2,A3,...) * MAX function restricted to scalar double precision.
DMIN1(A1,A2,A3,...) * MIN function restricted to scalar double precision.
DMOD(A,P) *P MOD function restricted to scalar double precision.
DNINT(A) *P ANINT function restricted to scalar double precision.
DOT_PRODUCT(VECTOR_A,VECTOR_B) Dot product.
DPROD(X,Y) EP Double precision result of X*Y.
DSIGN(A,B) *P SIGN function restricted to scalar double precision.
DSIN(X) *P SIN function restricted to scalar double precision.
DSINH(X) *P SINH function restricted to scalar double precision.
DSQRT(X) *P SQRT function restricted to scalar double precision.
DTAN(X) *P TAN function restricted to scalar double precision.
DTANH(X) *P TANH function restricted to scalar double precision.
EOSHIFT(ARRAY,SHIFT,BOUNDARY,DIM) End-off array shift.
EPSILON(X) I Number almost neglible compared to 1.
EXP(X) EP Exponential (eX).
EXPONENT(X) E The exponent part of a floating-point number.
FLOAT(A) * REAL function restricted to scalar default integer.
FLOOR(A,KIND) E Largest integer less than or equal to A.
FRACTION(X) E The mantissa of a floating-point number.
HUGE(X) I The largest number in the model for a real type.
IABS(A) *P ABS function restricted to scalar default integer.
IACHAR(C) E ASCII value for a character.
IAND(I,J) E Bitwise and.
IBCLR(I,POS) E Clear specified bit.
IBITS(I,POS,LEN) E Extract a group of bits.
IBSET(I,POS) E Set a bit.
ICHAR(C) E Native coded character set value for a character.
IDIM(X,Y) *P DIM function restricted to scalar default integer.
IDINT(A) * INT function restricted to scalar double precision.
IDNINT(A) *P NINT function restricted to scalar double precision.
IEOR(I,J) E Bitwise exclusive or.
IFIX(A) * INT function restricted to scalar default real.
INDEX(STRING,SUBSTRING,BACK) EP Search for substring.
INT(A,KIND) E Convert to integer.
IOR(I,J) E Bitwise inclusive or.
ISHFT(I,SHIFT) E Shift bits.
ISHFTC(I,SHIFT,SIZE) E Shift bits circularly.
ISIGN(A,B) *P SIGN function restricted to scalar default integer.
KIND(X) I Kind type parameter of X.
LBOUND(ARRAY,DIM) I Lower bound(s) of an array.
LEN(STRING) IP Length of a character string.
LEN_TRIM(STRING) E Length of a character string ignoring trailing blanks.
LGE(STRING_A,STRING_B) E Comparison (>=) using ASCII collating sequence.
LGT(STRING_A,STRING_B) E Comparison (>) using ASCII collating sequence.
LLE(STRING_A,STRING_B) E Comparison (<=) using ASCII collating sequence.
LLT(STRING_A,STRING_B) E Comparison (<) using ASCII collating sequence.
LOG(X) EP Natural logarithm.
LOG10(X) EP Common logarithm.
LOGICAL(L,KIND) E Convert to a specific logical kind.
MATMUL(MATRIX_A,MATRIX_B) Matrix multiplication.
MAX(A1,A2,A3,...) E Maximum value.
MAX0(A1,A2,A3,...) * MAX function restricted to scalar default integer.
MAX1(A1,A2,A3,...) * INT(MAX(A1,A2,A3,...)) with scalar default real args.
MAXEXPONENT(X) I Maximum model exponent value for X.
MAXLOC(ARRAY,MASK) Position of maximum value in an array.
MAXLOC(ARRAY,DIM,MASK) Dimensional reduction of maximum value positions.
MAXVAL(ARRAY,MASK) Reduce a (masked) array with the MAX intrinsic.
MAXVAL(ARRAY,DIM,MASK) Dimensional reduction by the MAX intrinsic.
MERGE(TSOURCE,FSOURCE,MASK) E Choose value depending on logical value.
MIN(A1,A2,A3,...) E Minimum value.
MIN0(A1,A2,A3,...) * MIN function restricted to scalar default integer.
MIN1(A1,A2,A3,...) * INT(MIN(A1,A2,A3,...)) with scalar default real args.
MINEXPONENT(X) I Minimum model exponent value for X.
MINLOC(ARRAY,MASK) Position of minimum value in an array.
MINLOC(ARRAY,DIM,MASK) Dimensional reduction of minimum value positions.
MINVAL(ARRAY,MASK) Reduce a (masked) array with the MIN intrinsic.
MINVAL(ARRAY,DIM,MASK) Dimensional reduction by the MIN intrinsic.
MOD(A,P) EP Remainder; sign(result) = sign(A).
MODULO(A,P) E Modulo; sign(result) = sign(P).
NEAREST(X,S) E Nearest machine-representable number.
NINT(A,KIND) EP Round and convert to integer.
NOT(I) E Bitwise complement.
NULL(MOLD) Null (disassociated) pointer.
PACK(ARRAY,MASK,VECTOR) Pack an array into a vector.
PRECISION(X) I Decimal model precision for X.
PRESENT(A) I Whether an optional argument is present.
PRODUCT(ARRAY,MASK) Reduce a (masked) array by multiplication.
PRODUCT(ARRAY,DIM,MASK) Dimensional reduction by multiplication.
RADIX(X) I Model radix for X.
RANGE(X) I Decimal model exponent range for X.
REAL(A,KIND) E Convert to real.
REPEAT(STRING,NCOPIES) Concatenate a string with itself.
RESHAPE(SOURCE,SHAPE,PAD,ORDER) Reshape an array.
RRSPACING(X) E Reciprocal relative model spacing near X.
SCALE(X,I) E X*RADIX(X)**I.
SCAN(STRING,SET,BACK) E Look for characters in a set.
SELECTED_INT_KIND(R) Integer kind with at least R decimal digits.
SELECTED_REAL_KIND(P,R) Real kind with at least P decimal precision and/or
at least R decimal exponent range.
SET_EXPONENT(X,I) E X*RADIX(X)**(I-EXPONENT(X)).
SHAPE(SOURCE) I Shape of an array.
SIGN(A,B) EP A with the sign of B.
SIN(X) EP Sine.
SINH(X) EP Hyperbolic sine.
SIZE(ARRAY,DIM) I Size of an array or dimension.
SNGL(A) * REAL function restricted to scalar double precision.
SPACING(X) E Spacing of model numbers near X.
SPREAD(SOURCE,DIM,NCOPIES) Replicate an array in a given dimension by copying.
SQRT(X) EP Square root.
SUM(ARRAY,MASK) Reduce a (masked) array by addition.
SUM(ARRAY,DIM,MASK) Dimensional reduction of a (masked) array by addition.
TAN(X) EP Tangent.
TANH(X) EP Hyperbolic tangent.
TINY(X) I Smallest model number for the kind of X.
TRANSFER(SOURCE,MOLD,SIZE) Copy internal representation.
TRANSPOSE(MATRIX) Transpose an array.
TRIM(STRING) Character string with trailing blanks removed.
UBOUND(ARRAY,DIM) I Upper bound(s) of an array.
UNPACK(VECTOR,MASK,FIELD) Unpack a vector into an array.
VERIFY(STRING,SET,BACK) E Look for characters not in set.

Intrinsic Subroutines

Subroutine Name Flags Description
CPU_TIME(TIME) CPU execution time.
DATE_AND_TIME(DATE,TIME,ZONE,VALUES) Date and time information.
MVBITS(FROM,FROMPOS,LEN,TO,TOPOS) E Move or copy bitfield.
RANDOM_NUMBER(HARVEST) Return pseudo-random number(s).
RANDOM_SEED(SIZE,PUT,GET) Control pseudo-random number generator.
SYSTEM_CLOCK(COUNT,COUNT_RATE,COUNT_MAX) Real-time clock information.