Intrinsic procedures are built into the language and need no use or declaration. They are elemental (work on a scalar and, applied to an array, on every element),
inquiry (ask about a type or an array, not its value), transformational (turn arrays into a new array or a scalar) or subroutines (called with call).
Most have generic names, so abs serves integers, reals and complex values of every kind. Arguments may be given by keyword (sum(a, dim=2, mask=a > 0)).
The viewer colours every name listed here as a function when it is followed by ( (or after call), unless the statement is a declaration of that name or the name is assigned to.
Versions in the tables mean the standard that first had the procedure; a procedure with no version is from FORTRAN 77 or Fortran 90. Names marked † are in the GNU Fortran manual and not in the standard.
Numeric
| Procedures | What they do |
|---|---|
abs, aimag, aint, anint, ceiling, cmplx, conjg, dble, dim, dprod, floor, int, nint, real | absolute value, imaginary part, truncation, rounding, conversion, positive difference, product in double precision. ceiling and floor (Fortran 90) round to integers |
max, min, mod, modulo, sign | largest and smallest of many arguments, remainder with the sign of the first argument (mod) or of the second (modulo), sign transfer |
float, sngl, ifix, idint, idnint, dfloat, dreal, dimag, dconjg, dcmplx | specific names and conversions of FORTRAN 77 and DEC |
Mathematical
| Procedures | What they do |
|---|---|
sqrt, exp, log, log10 | square root, exponential, natural and decimal logarithms |
sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh | trigonometric and hyperbolic functions, in radians |
asinh, acosh, atanh, bessel_j0, bessel_j1, bessel_jn, bessel_y0, bessel_y1, bessel_yn, erf, erfc, erfc_scaled, gamma, log_gamma, hypot, norm2 | Fortran 2008 |
sind, cosd, tand, asind, acosd, atand, atan2d, sinpi, cospi, tanpi, asinpi, acospi, atanpi, atan2pi | Fortran 2023: trigonometry in degrees and in half-turns (multiples of π) |
cotan†, cotand† | cotangent, in GNU Fortran |
Character
| Procedures | What they do |
|---|---|
achar, char, iachar, ichar | character to code and back: achar and iachar use ASCII |
adjustl, adjustr, trim, len, len_trim, repeat | justify, drop trailing blanks, lengths, repeat a string |
index, scan, verify | find a substring or a set of characters; index and scan take back= (Fortran 90) |
lge, lgt, lle, llt | comparison by the ASCII sequence |
new_line | the newline character of a kind (Fortran 2003) |
split, tokenize | Fortran 2023: find the delimiters in a string, and cut a string into tokens |
Kind and numeric inquiry
| Procedures | What they do |
|---|---|
kind, selected_int_kind, selected_real_kind, selected_char_kind (F2003), selected_logical_kind (F2023) | find kinds by value or required range |
digits, epsilon, huge, maxexponent, minexponent, precision, radix, range, tiny | properties of a numeric model |
exponent, fraction, nearest, rrspacing, scale, set_exponent, spacing | work on the parts of a real |
bit_size | number of bits of an integer |
Bit
| Procedures | What they do |
|---|---|
btest, iand, ibclr, ibits, ibset, ieor, ior, ishft, ishftc, not, mvbits | test, clear, set, extract and combine bits (mvbits is a subroutine). Standard since Fortran 90, from MIL-STD-1753 |
bge, bgt, ble, blt, dshiftl, dshiftr, iall, iany, iparity, leadz, maskl, maskr, merge_bits, popcnt, poppar, shifta, shiftl, shiftr, trailz | Fortran 2008: unsigned compare, double shifts, reductions, leading and trailing zeros, masks, population count, arithmetic and logical shifts |
out_of_range | Fortran 2018: whether a value fits a type, for safe conversion |
Array
| Procedures | What they do |
|---|---|
all, any, count, maxval, minval, product, sum | reductions of an array, with dim= and mask= |
maxloc, minloc, findloc (F2008) | positions of the largest, smallest or a given value |
parity, norm2, reduce (F2018) | exclusive or of logicals, Euclidean norm, a reduction with your own function |
dot_product, matmul, transpose | linear algebra |
cshift, eoshift, merge, pack, unpack, reshape, spread | rearrange arrays |
lbound, ubound, shape, size, allocated, is_contiguous (F2008), rank (F2018) | inquire about an array |
Pointer, object and storage
| Procedures | What they do |
|---|---|
associated, null (F95), present | pointer status, a disassociated pointer, whether an optional argument was given |
extends_type_of, same_type_as (F2003), storage_size (F2008) | dynamic type and size |
move_alloc (F2003), transfer | move an allocation; reinterpret bits as another type |
c_associated, c_f_pointer, c_f_procpointer, c_funloc, c_loc, c_sizeof | in iso_c_binding, to move between C and Fortran pointers. c_f_strpointer† and f_c_string† are GNU |
sizeof†, loc† | extensions: size in bytes and the address |
Random numbers, time and system
| Procedures | What they do |
|---|---|
random_number, random_seed, random_init (F2018) | subroutines for pseudo-random numbers |
cpu_time (F95), date_and_time, system_clock | subroutines for time |
command_argument_count, get_command, get_command_argument, get_environment_variable | the command line and the environment (Fortran 2003) |
execute_command_line, compiler_options, compiler_version | Fortran 2008: run a command, describe the compiler |
is_iostat_end, is_iostat_eor | test iostat codes (Fortran 2003) |
Coarray, atomic and collective
| Procedures | What they do |
|---|---|
this_image, num_images, image_index, lcobound, ucobound, coshape | Fortran 2008: which image, how many, cobounds |
atomic_define, atomic_ref (F2008); atomic_add, atomic_and, atomic_cas, atomic_fetch_add, atomic_fetch_and, atomic_fetch_or, atomic_fetch_xor, atomic_or, atomic_xor (F2018) | atomic operations on a variable of another image |
co_sum, co_min, co_max, co_reduce, co_broadcast | Fortran 2018: collective subroutines across all images |
event_query, failed_images, stopped_images, image_status, get_team, team_number | Fortran 2018: events, failed images, teams |
See Parallel features.
FORTRAN 77 specific names
In FORTRAN 77 and earlier each type had its own name for a function: alog, alog10, amax0, amax1, amin0, amin1, amod, cabs, ccos, cexp, clog, csin, csqrt,
dabs, dacos, dasin, datan, datan2, dcos, dcosh, ddim, dexp, dint, dlog, dlog10, dmax1, dmin1, dmod, dnint, dsign, dsin, dsinh, dsqrt, dtan, dtanh,
iabs, idim, idint, idnint, ifix, isign, max0, max1, min0, min1, float, sngl. The generic names replaced them in Fortran 90; the specific names are still standard and the
Fortran 2018 revision is reported to list them as obsolescent (see Versions and standards). DEC compilers add cdabs, cdexp, cdlog, cdsin, cdcos, cdsqrt, zabs, zexp, zlog, zsin, zcos, zsqrt for double complex.
GNU and DEC extensions
The GNU Fortran manual lists these as procedures it adds: abort, access, alarm, and, backtrace, besj0, besj1, besjn, besy0, besy1, besyn, chdir, chmod, ctime, dtime, etime, exit,
fdate, fget, fgetc, flush, fnum, fput, fputc, free, fseek, fstat, ftell, gerror, getarg, getcwd, getenv, getgid, getlog, getpid, getuid, gmtime, hostnm,
iargc, idate, ierrno, irand, isatty, isnan, itime, kill, link, lnblnk, loc, lshift, lstat, ltime, malloc, mclock, mclock8, or, perror, ran, rand, rename, rshift,
second, secnds, signal, sleep, srand, stat, symlnk, system, time, time8, ttynam, umask, unlink, xor, and the DEC bit and integer variants biand, iiand, jiand, kiand and the like. Names such as time, stat, exit and free are common variable and procedure names, so the viewer colours them as functions only when they are used with a parenthesis in an expression or are the target of call.
Using intrinsics
intrinsic sin, cosstates that these names are the intrinsics (needed to pass one as an argument)- a user procedure may have the name of an intrinsic and then hides it in that scope
-std=f95and similar options of GNU Fortran refuse intrinsics from later standards, and-fall-intrinsicsallows them all