Intrinsic Procedures
********************

This portion of the document is incomplete and undergoing massive expansion and editing.  All contributions and corrections are strongly encouraged.

Implemented intrinsics are fully functional and available to the user to apply. Some intrinsics have documentation yet to be completed as indicated by 'documentation pending'.

Introduction to intrinsic procedures
====================================

Gfortran provides a rich set of intrinsic procedures that includes all the intrinsic procedures required by the Fortran 95 standard, a set of intrinsic procedures for backwards compatibility with Gnu Fortran 77 (i.e., g77), and a small selection of intrinsic procedures from the Fortran 2003 standard.  Any description here, which conflicts with a description in either the Fortran 95 standard or the Fortran 2003 standard, is unintentional and the standard(s) should be considered authoritative.

The enumeration of the KIND type parameter is processor defined in the Fortran 95 standard.  Gfortran defines the default integer type and default real type by INTEGER(KIND=4) and REAL(KIND=4), respectively.  The standard mandates that both data types shall have another kind, which have more precision.  On typical target architectures supported by gfortran, this kind type parameter is KIND=8. Hence, REAL(KIND=8) and DOUBLE PRECISION are equivalent. In the description of generic intrinsic procedures, the kind type parameter will be specified by KIND=*, and in the description of specific names for an intrinsic procedure the kind type parameter will be explicitly given (e.g., REAL(KIND=4) or REAL(KIND=8)).  Finally, for brevity the optional KIND= syntax will be omitted.

Many of the intrinsics procedures take one or more optional arguments. This document follows the convention used in the Fortran 95 standard, and denotes such arguments by square brackets.

Gfortran offers the -std=f95 and -std=gnu options, which can be used to restrict the set of intrinsic procedures to a given standard.  By default, gfortran sets the -std=gnu option, and so all intrinsic procedures described here are accepted.  There is one caveat.  For a select group of intrinsic procedures, g77 implemented both a function and a subroutine.  Both classes have been implemented in gfortran for backwards compatibility with g77.  It is noted here that these functions and subroutines cannot be intermixed in a given subprogram.  In the descriptions that follow, the applicable option(s) is noted.

ABORT --- Abort the program
===========================

Description:
     ABORT causes immediate termination of the program.  On operating systems that support a core dump, ABORT will produce a core dump, which is suitable for debugging purposes.

Standard:
     GNU extension

Class:
     non-elemental subroutine

Syntax:
     CALL ABORT

Return value:
     Does not return.

Example:

          program test_abort
            integer :: i = 1, j = 2
            if (i /= j) call abort
          end program test_abort

See also:
     EXIT, KILL

ABS --- Absolute value
======================

Description:
     ABS(X) computes the absolute value of X.

Standard:
     F77 and later, has overloads that are GNU extensions

Class:
     Elemental function

Syntax:
     X = ABS(X)

Arguments:

     X   The type of the argument shall be an INTEGER(*),
     REAL(*), or COMPLEX(*).

Return value:
     The return value is of the same type and kind as the argument except the return value is REAL(*) for a COMPLEX(*) argument.

Example:

          program test_abs
            integer :: i = -1
            real :: x = -1.e0
            complex :: z = (-1.e0,0.e0)
            i = abs(i)
            x = abs(x)
            x = abs(z)
          end program test_abs

Specific names:

     Name              Argument              Return type         Standard
     CABS(Z)    COMPLEX(4) Z   REAL(4)      F77 and later
     DABS(X)    REAL(8)    X   REAL(8)      F77 and later
     IABS(I)    INTEGER(4) I   INTEGER(4)   F77 and later
     ZABS(Z)    COMPLEX(8) Z   COMPLEX(8)   GNU extension
     CDABS(Z)   COMPLEX(8) Z   COMPLEX(8)   GNU extension

ACCESS --- Checks file access method
====================================

Not yet implemented in gfortran.

Description:

Standard:
     GNU extension

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     g77 features lacking in gfortran (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292)

ACHAR --- Character in ASCII collating sequence
===============================================

Description:
     ACHAR(I) returns the character located at position I in the ASCII collating sequence.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     C = ACHAR(I)

Arguments:

     I   The type shall be INTEGER(*).

Return value:
     The return value is of type CHARACTER with a length of one.  The kind type parameter is the same as  KIND('A').

Example:

          program test_achar
            character c
            c = achar(32)
          end program test_achar

ACOS --- Arccosine function
===========================

Description:
     ACOS(X) computes the arccosine of X (inverse of COS(X)).

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = ACOS(X)

Arguments:

     X   The type shall be REAL(*) with a magnitude that is
     less than one.

Return value:
     The return value is of type REAL(*) and it lies in the range  0 \leq \acos(x) \leq \pi. The kind type parameter is the same as X.

Example:

          program test_acos
            real(8) :: x = 0.866_8
            x = acos(x)
          end program test_acos

Specific names:

     Name              Argument            Return type         Standard
     DACOS(X)   REAL(8) X    REAL(8)      F77 and later

See also:
     Inverse function: COS

ACOSH --- Hyperbolic arccosine function
=======================================

Description:
     ACOSH(X) computes the area hyperbolic cosine of X (inverse of COSH(X)).

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = ACOSH(X)

Arguments:

     X   The type shall be REAL(*) with a magnitude that is
     greater or equal to one.

Return value:
     The return value is of type REAL(*) and it lies in the range 0 \leq \acosh (x) \leq \infty.

Example:

          PROGRAM test_acosh
            REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
            WRITE (*,*) ACOSH(x)
          END PROGRAM

See also:
     Inverse function: COSH

ADJUSTL --- Left adjust a string
================================

Description:
     ADJUSTL(STR) will left adjust a string by removing leading spaces. Spaces are inserted at the end of the string as needed.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     STR = ADJUSTL(STR)

Arguments:

     STR   The type shall be CHARACTER.

Return value:
     The return value is of type CHARACTER where leading spaces are removed and the same number of spaces are inserted on the end of STR.

Example:

          program test_adjustl
            character(len=20) :: str = '   gfortran'
            str = adjustl(str)
            print *, str
          end program test_adjustl

ADJUSTR --- Right adjust a string
=================================

Description:
     ADJUSTR(STR) will right adjust a string by removing trailing spaces. Spaces are inserted at the start of the string as needed.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     STR = ADJUSTR(STR)

Arguments:

     STR   The type shall be CHARACTER.

Return value:
     The return value is of type CHARACTER where trailing spaces are removed and the same number of spaces are inserted at the start of STR.

Example:

          program test_adjustr
            character(len=20) :: str = 'gfortran'
            str = adjustr(str)
            print *, str
          end program test_adjustr

AIMAG --- Imaginary part of complex number
==========================================

Description:
     AIMAG(Z) yields the imaginary part of complex argument Z. The IMAG(Z) and IMAGPART(Z) intrinsic functions are provided for compatibility with g77, and their use in new code is strongly discouraged.

Standard:
     F77 and later, has overloads that are GNU extensions

Class:
     Elemental function

Syntax:
     X = AIMAG(Z)

Arguments:

     Z   The type of the argument shall be COMPLEX(*).

Return value:
     The return value is of type real with the kind type parameter of the argument.

Example:

          program test_aimag
            complex(4) z4
            complex(8) z8
            z4 = cmplx(1.e0_4, 0.e0_4)
            z8 = cmplx(0.e0_8, 1.e0_8)
            print *, aimag(z4), dimag(z8)
          end program test_aimag

Specific names:

     Name              Argument              Return type         Standard
     DIMAG(Z)   COMPLEX(8) Z   REAL(8)      F95 and later
     IMAG(Z)    COMPLEX(*) Z   REAL(*)      GNU extension
     IMAGPART(Z)   COMPLEX(*) Z   REAL(*)   GNU extension

AINT --- Truncate to a whole number
===================================

Description:
     AINT(X [, KIND]) truncates its argument to a whole number.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = AINT(X) X = AINT(X, KIND)

Arguments:

     X      The type of the argument shall be REAL(*).
     KIND   (Optional) KIND shall be a scalar integer
     initialization expression.

Return value:
     The return value is of type real with the kind type parameter of the argument if the optional KIND is absent; otherwise, the kind type parameter will be given by KIND.  If the magnitude of X is less than one, then AINT(X) returns zero.  If the magnitude is equal to or greater than one, then it returns the largest whole number that does not exceed its magnitude.  The sign is the same as the sign of X.

Example:

          program test_aint
            real(4) x4
            real(8) x8
            x4 = 1.234E0_4
            x8 = 4.321_8
            print *, aint(x4), dint(x8)
            x8 = aint(x4,8)
          end program test_aint

Specific names:

     Name             Argument           Return type        Standard
     DINT(X)   REAL(8) X   REAL(8)     F77 and later

ALARM --- Execute a routine after a given delay
===============================================

Description:
     ALARM(SECONDS, HANDLER [, STATUS]) causes external subroutine HANDLER to be executed after a delay of SECONDS by using alarm(1) to set up a signal and signal(2) to catch it. If STATUS is supplied, it will be returned with the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm.

Standard:
     GNU extension

Class:
     Subroutine

Syntax:
     CALL ALARM(SECONDS, HANDLER) CALL ALARM(SECONDS, HANDLER, STATUS)

Arguments:

     SECONDS   The type of the argument shall be a scalar
     INTEGER. It is INTENT(IN).
     HANDLER   Signal handler (INTEGER FUNCTION or
     SUBROUTINE) or dummy/global INTEGER scalar.
     INTEGER. It is INTENT(IN).
     STATUS    (Optional) STATUS shall be a scalar
     INTEGER variable. It is INTENT(OUT).

Example:

          program test_alarm
            external handler_print
            integer i
            call alarm (3, handler_print, i)
            print *, i
            call sleep(10)
          end program test_alarm

     This will cause the external routine HANDLER_PRINT to be called after 3 seconds.

ALL --- All values in MASK along DIM are true
=============================================

Description:
     ALL(MASK [, DIM]) determines if all the values are true in MASK in the array along dimension DIM.

Standard:
     F95 and later

Class:
     transformational function

Syntax:
     L = ALL(MASK) L = ALL(MASK, DIM)

Arguments:

     MASK   The type of the argument shall be LOGICAL(*) and
     it shall not be scalar.
     DIM    (Optional) DIM shall be a scalar integer
     with a value that lies between one and the rank of MASK.

Return value:
     ALL(MASK) returns a scalar value of type LOGICAL(*) where the kind type parameter is the same as the kind type parameter of MASK.  If DIM is present, then ALL(MASK, DIM) returns an array with the rank of MASK minus 1.  The shape is determined from the shape of MASK where the DIM dimension is elided.

     (A)
          ALL(MASK) is true if all elements of MASK are true. It also is true if MASK has zero size; otherwise, it is false.

     (B)
          If the rank of MASK is one, then ALL(MASK,DIM) is equivalent to ALL(MASK).  If the rank is greater than one, then ALL(MASK,DIM) is determined by applying ALL to the array sections.

Example:

          program test_all
            logical l
            l = all((/.true., .true., .true./))
            print *, l
            call section
            contains
              subroutine section
                integer a(2,3), b(2,3)
                a = 1
                b = 1
                b(2,2) = 2
                print *, all(a .eq. b, 1)
                print *, all(a .eq. b, 2)
              end subroutine section
          end program test_all

ALLOCATED --- Status of an allocatable entity
=============================================

Description:
     ALLOCATED(X) checks the status of whether X is allocated.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     L = ALLOCATED(X)

Arguments:

     X      The argument shall be an ALLOCATABLE array.

Return value:
     The return value is a scalar LOGICAL with the default logical kind type parameter.  If X is allocated, ALLOCATED(X) is .TRUE.; otherwise, it returns the .TRUE.

Example:

          program test_allocated
            integer :: i = 4
            real(4), allocatable :: x(:)
            if (allocated(x) .eqv. .false.) allocate(x(i))
          end program test_allocated

AND --- Bitwise logical AND
===========================

Description:
     Bitwise logical AND.

     This intrinsic routine is provided for backwards compatibility with GNU Fortran 77.  For integer arguments, programmers should consider the use of the IAND intrinsic defined by the Fortran standard.

Standard:
     GNU extension

Class:
     Non-elemental function

Syntax:
     RESULT = AND(X, Y)

Arguments:

     X   The type shall be either INTEGER(*) or LOGICAL.
     Y   The type shall be either INTEGER(*) or LOGICAL.

Return value:
     The return type is either INTEGER(*) or LOGICAL after cross-promotion of the arguments.

Example:

          PROGRAM test_and
            LOGICAL :: T = .TRUE., F = ..FALSE.
            INTEGER :: a, b
            DATA a / Z'F' /, b / Z'3' /

            WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
            WRITE (*,*) AND(a, b)
          END PROGRAM

See also:
     F95 elemental function: IAND

ANINT --- Nearest whole number
==============================

Description:
     ANINT(X [, KIND]) rounds its argument to the nearest whole number.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = ANINT(X) X = ANINT(X, KIND)

Arguments:

     X      The type of the argument shall be REAL(*).
     KIND   (Optional) KIND shall be a scalar integer
     initialization expression.

Return value:
     The return value is of type real with the kind type parameter of the argument if the optional KIND is absent; otherwise, the kind type parameter will be given by KIND.  If X is greater than zero, then ANINT(X) returns AINT(X+0.5).  If X is less than or equal to zero, then it returns AINT(X-0.5).

Example:

          program test_anint
            real(4) x4
            real(8) x8
            x4 = 1.234E0_4
            x8 = 4.321_8
            print *, anint(x4), dnint(x8)
            x8 = anint(x4,8)
          end program test_anint

Specific names:

     Name              Argument           Return type        Standard
     DNINT(X)   REAL(8) X   REAL(8)     F77 and later

ANY --- Any value in MASK along DIM is true
===========================================

Description:
     ANY(MASK [, DIM]) determines if any of the values in the logical array MASK along dimension DIM are .TRUE..

Standard:
     F95 and later

Class:
     transformational function

Syntax:
     L = ANY(MASK) L = ANY(MASK, DIM)

Arguments:

     MASK   The type of the argument shall be LOGICAL(*) and
     it shall not be scalar.
     DIM    (Optional) DIM shall be a scalar integer
     with a value that lies between one and the rank of MASK.

Return value:
     ANY(MASK) returns a scalar value of type LOGICAL(*) where the kind type parameter is the same as the kind type parameter of MASK.  If DIM is present, then ANY(MASK, DIM) returns an array with the rank of MASK minus 1.  The shape is determined from the shape of MASK where the DIM dimension is elided.

     (A)
          ANY(MASK) is true if any element of MASK is true; otherwise, it is false.  It also is false if MASK has zero size.

     (B)
          If the rank of MASK is one, then ANY(MASK,DIM) is equivalent to ANY(MASK).  If the rank is greater than one, then ANY(MASK,DIM) is determined by applying ANY to the array sections.

Example:

          program test_any
            logical l
            l = any((/.true., .true., .true./))
            print *, l
            call section
            contains
              subroutine section
                integer a(2,3), b(2,3)
                a = 1
                b = 1
                b(2,2) = 2
                print *, any(a .eq. b, 1)
                print *, any(a .eq. b, 2)
              end subroutine section
          end program test_any

ASIN --- Arcsine function
=========================

Description:
     ASIN(X) computes the arcsine of its X (inverse of SIN(X)).

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = ASIN(X)

Arguments:

     X   The type shall be REAL(*), and a magnitude that is
     less than one.

Return value:
     The return value is of type REAL(*) and it lies in the range -\pi / 2 \leq \asin (x) \leq \pi / 2.  The kind type parameter is the same as X.

Example:

          program test_asin
            real(8) :: x = 0.866_8
            x = asin(x)
          end program test_asin

Specific names:

     Name              Argument            Return type         Standard
     DASIN(X)   REAL(8) X    REAL(8)      F77 and later

See also:
     Inverse function: SIN

ASINH --- Hyperbolic arcsine function
=====================================

Description:
     ASINH(X) computes the area hyperbolic sine of X (inverse of SINH(X)).

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = ASINH(X)

Arguments:

     X   The type shall be REAL(*), with X a real number.

Return value:
     The return value is of type REAL(*) and it lies in the range -\infty \leq \asinh (x) \leq \infty.

Example:

          PROGRAM test_asinh
            REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
            WRITE (*,*) ASINH(x)
          END PROGRAM

See also:
     Inverse function: SINH

ASSOCIATED --- Status of a pointer or pointer/target pair
=========================================================

Description:
     ASSOCIATED(PTR [, TGT]) determines the status of the pointer PTR or if PTR is associated with the target TGT.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     L = ASSOCIATED(PTR) L = ASSOCIATED(PTR [, TGT])

Arguments:

     PTR   PTR shall have the POINTER attribute and
     it can be of any type.
     TGT   (Optional) TGT shall be a POINTER or
     a TARGET.  It must have the same type, kind type parameter, and
     array rank as PTR.

     The status of neither PTR nor TGT can be undefined.

Return value:
     ASSOCIATED(PTR) returns a scalar value of type LOGICAL(4). There are several cases:

     (A) If the optional TGT is not present, then ASSOCIATED(PTR)
          is true if PTR is associated with a target; otherwise, it returns false.

     (B) If TGT is present and a scalar target, the result is true if
          TGT is not a 0 sized storage sequence and the target associated with PTR occupies the same storage units.  If PTR is disassociated, then the result is false.

     (C) If TGT is present and an array target, the result is true if
          TGT and PTR have the same shape, are not 0 sized arrays, are arrays whose elements are not 0 sized storage sequences, and TGT and PTR occupy the same storage units in array element order. As in case(B), the result is false, if PTR is disassociated.

     (D) If TGT is present and an scalar pointer, the result is true if
          target associated with PTR and the target associated with TGT are not 0 sized storage sequences and occupy the same storage units. The result is false, if either TGT or PTR is disassociated.

     (E) If TGT is present and an array pointer, the result is true if
          target associated with PTR and the target associated with TGT have the same shape, are not 0 sized arrays, are arrays whose elements are not 0 sized storage sequences, and TGT and PTR occupy the same storage units in array element order. The result is false, if either TGT or PTR is disassociated.

Example:

          program test_associated
             implicit none
             real, target  :: tgt(2) = (/1., 2./)
             real, pointer :: ptr(:)
             ptr => tgt
             if (associated(ptr)     .eqv. .false.) call abort
             if (associated(ptr,tgt) .eqv. .false.) call abort
          end program test_associated

See also:
     NULL

ATAN --- Arctangent function
============================

Description:
     ATAN(X) computes the arctangent of X.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = ATAN(X)

Arguments:

     X   The type shall be REAL(*).

Return value:
     The return value is of type REAL(*) and it lies in the range  - \pi / 2 \leq \atan (x) \leq \pi / 2.

Example:

          program test_atan
            real(8) :: x = 2.866_8
            x = atan(x)
          end program test_atan

Specific names:

     Name              Argument            Return type         Standard
     DATAN(X)   REAL(8) X    REAL(8)      F77 and later

See also:
     Inverse function: TAN

ATAN2 --- Arctangent function
=============================

Description:
     ATAN2(Y,X) computes the arctangent of the complex number X + i Y.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = ATAN2(Y,X)

Arguments:

     Y   The type shall be REAL(*).
     X   The type and kind type parameter shall be the same as Y.
     If Y is zero, then X must be nonzero.

Return value:
     The return value has the same type and kind type parameter as Y. It is the principal value of the complex number X + i Y.  If X is nonzero, then it lies in the range -\pi \le \atan (x) \leq \pi. The sign is positive if Y is positive.  If Y is zero, then the return value is zero if X is positive and \pi if X is negative.  Finally, if X is zero, then the magnitude of the result is \pi/2.

Example:

          program test_atan2
            real(4) :: x = 1.e0_4, y = 0.5e0_4
            x = atan2(y,x)
          end program test_atan2

Specific names:

     Name              Argument            Return type      Standard
     DATAN2(X)   REAL(8) X   REAL(8)   F77 and later

ATANH --- Hyperbolic arctangent function
========================================

Description:
     ATANH(X) computes the area hyperbolic sine of X (inverse of TANH(X)).

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = ATANH(X)

Arguments:

     X   The type shall be REAL(*) with a magnitude that is less than or equal to one.

Return value:
     The return value is of type REAL(*) and it lies in the range -\infty \leq \atanh(x) \leq \infty.

Example:

          PROGRAM test_atanh
            REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
            WRITE (*,*) ATANH(x)
          END PROGRAM

See also:
     Inverse function: TANH

BESJ0 --- Bessel function of the first kind of order 0
======================================================

Description:
     BESJ0(X) computes the Bessel function of the first kind of order 0 of X.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = BESJ0(X)

Arguments:

     X   The type shall be REAL(*), and it shall be scalar.

Return value:
     The return value is of type REAL(*) and it lies in the range  - 0.4027... \leq Bessel (0,x) \leq 1.

Example:

          program test_besj0
            real(8) :: x = 0.0_8
            x = besj0(x)
          end program test_besj0

Specific names:

     Name              Argument            Return type         Standard
     DBESJ0(X)   REAL(8) X    REAL(8)     GNU extension

BESJ1 --- Bessel function of the first kind of order 1
======================================================

Description:
     BESJ1(X) computes the Bessel function of the first kind of order 1 of X.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = BESJ1(X)

Arguments:

     X   The type shall be REAL(*), and it shall be scalar.

Return value:
     The return value is of type REAL(*) and it lies in the range  - 0.5818... \leq Bessel (0,x) \leq 0.5818 .

Example:

          program test_besj1
            real(8) :: x = 1.0_8
            x = besj1(x)
          end program test_besj1

Specific names:

     Name              Argument            Return type         Standard
     DBESJ1(X)  REAL(8) X    REAL(8)      GNU extension

BESJN --- Bessel function of the first kind
===========================================

Description:
     BESJN(N, X) computes the Bessel function of the first kind of order N of X.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     Y = BESJN(N, X)

Arguments:

     N   The type shall be INTEGER(*), and it shall be scalar.
     X   The type shall be REAL(*), and it shall be scalar.

Return value:
     The return value is a scalar of type REAL(*).

Example:

          program test_besjn
            real(8) :: x = 1.0_8
            x = besjn(5,x)
          end program test_besjn

Specific names:

     Name               Argument              Return type         Standard
     DBESJN(X)   INTEGER(*) N   REAL(8)      GNU extension
       REAL(8) X

BESY0 --- Bessel function of the second kind of order 0
=======================================================

Description:
     BESY0(X) computes the Bessel function of the second kind of order 0 of X.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = BESY0(X)

Arguments:

     X   The type shall be REAL(*), and it shall be scalar.

Return value:
     The return value is a scalar of type REAL(*).

Example:

          program test_besy0
            real(8) :: x = 0.0_8
            x = besy0(x)
          end program test_besy0

Specific names:

     Name              Argument            Return type         Standard
     DBESY0(X)  REAL(8) X    REAL(8)      GNU extension

BESY1 --- Bessel function of the second kind of order 1
=======================================================

Description:
     BESY1(X) computes the Bessel function of the second kind of order 1 of X.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = BESY1(X)

Arguments:

     X   The type shall be REAL(*), and it shall be scalar.

Return value:
     The return value is a scalar of type REAL(*).

Example:

          program test_besy1
            real(8) :: x = 1.0_8
            x = besy1(x)
          end program test_besy1

Specific names:

     Name              Argument            Return type         Standard
     DBESY1(X)  REAL(8) X    REAL(8)      GNU extension

BESYN --- Bessel function of the second kind
============================================

Description:
     BESYN(N, X) computes the Bessel function of the second kind of order N of X.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     Y = BESYN(N, X)

Arguments:

     N   The type shall be INTEGER(*), and it shall be scalar.
     X   The type shall be REAL(*), and it shall be scalar.

Return value:
     The return value is a scalar of type REAL(*).

Example:

          program test_besyn
            real(8) :: x = 1.0_8
            x = besyn(5,x)
          end program test_besyn

Specific names:

     Name                 Argument              Return type       Standard
     DBESYN(N,X)   INTEGER(*) N   REAL(8)    GNU extension
       REAL(8)    X

BIT_SIZE --- Bit size inquiry function
======================================

Description:
     BIT_SIZE(I) returns the number of bits (integer precision plus sign bit) represented by the type of I.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     I = BIT_SIZE(I)

Arguments:

     I   The type shall be INTEGER(*).

Return value:
     The return value is of type INTEGER(*)

Example:

          program test_bit_size
              integer :: i = 123
              integer :: size
              size = bit_size(i)
              print *, size
          end program test_bit_size

BTEST --- Bit test function
===========================

Description:
     BTEST(I,POS) returns logical .TRUE. if the bit at POS in I is set.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     I = BTEST(I,POS)

Arguments:

     I   The type shall be INTEGER(*).
     POS   The type shall be INTEGER(*).

Return value:
     The return value is of type LOGICAL

Example:

          program test_btest
              integer :: i = 32768 + 1024 + 64
              integer :: pos
              logical :: bool
              do pos=0,16
                  bool = btest(i, pos)
                  print *, pos, bool
              end do
          end program test_btest

CEILING --- Integer ceiling function
====================================

Description:
     CEILING(X) returns the least integer greater than or equal to X.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     I = CEILING(X[,KIND])

Arguments:

     X   The type shall be REAL(*).
     KIND   (Optional) scalar integer initialization expression.

Return value:
     The return value is of type INTEGER(KIND)

Example:

          program test_ceiling
              real :: x = 63.29
              real :: y = -63.59
              print *, ceiling(x) ! returns 64
              print *, ceiling(y) ! returns -63
          end program test_ceiling

See also:
     FLOOR, NINT

CHAR --- Character conversion function
======================================

Description:
     CHAR(I,[KIND]) returns the character represented by the integer I.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     C = CHAR(I[,KIND])

Arguments:

     I   The type shall be INTEGER(*).
     KIND   Optional scaler integer initialization expression.

Return value:
     The return value is of type CHARACTER(1)

Example:

          program test_char
              integer :: i = 74
              character(1) :: c
              c = char(i)
              print *, i, c ! returns 'J'
          end program test_char

See also:
     ACHAR, ICHAR, IACHAR

CHDIR --- Change working directory
==================================

Description:
     Change current working directory to a specified PATH.

Standard:
     GNU extension

Class:
     Non-elemental subroutine

Syntax:
     CALL chdir(PATH[,STATUS])

Arguments:

     PATH     The type shall be CHARACTER(*) and shall specify a valid path within the file system.
     STATUS   (Optional) status flag. Returns 0 on success,
     a system specific and non-zero error code otherwise.

Example:

          PROGRAM test_chdir
            CHARACTER(len=255) :: path
            CALL getcwd(path)
            WRITE(*,*) TRIM(path)
            CALL chdir("/tmp")
            CALL getcwd(path)
            WRITE(*,*) TRIM(path)
          END PROGRAM

See also:
     GETCWD

CHMOD --- Change access permissions of files
============================================

Not yet implemented in gfortran.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     g77 features lacking in gfortran (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292)

CMPLX --- Complex conversion function
=====================================

Description:
     CMPLX(X[,Y[,KIND]]) returns a complex number where X is converted to the real component.  If Y is present it is converted to the imaginary component.  If Y is not present then the imaginary component is set to 0.0.  If X is complex then Y must not be present.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     C = CMPLX(X[,Y[,KIND]])

Arguments:

     X   The type may be INTEGER(*), REAL(*), or COMPLEX(*).
     Y   Optional, allowed if X is not COMPLEX(*).  May be INTEGER(*) or REAL(*).
     KIND   Optional scaler integer initialization expression.

Return value:
     The return value is of type COMPLEX(*)

Example:

          program test_cmplx
              integer :: i = 42
              real :: x = 3.14
              complex :: z
              z = cmplx(i, x)
              print *, z, cmplx(x)
          end program test_cmplx

COMMAND_ARGUMENT_COUNT --- Argument count function
==================================================

Description:
     COMMAND_ARGUMENT_COUNT() returns the number of arguments passed on the command line when the containing program was invoked.

Standard:
     F2003

Class:
     Inquiry function

Syntax:
     I = COMMAND_ARGUMENT_COUNT()

Arguments:

     None

Return value:
     The return value is of type INTEGER(4)

Example:

          program test_command_argument_count
              integer :: count
              count = command_argument_count()
              print *, count
          end program test_command_argument_count

CONJG --- Complex conjugate function
====================================

Description:
     CONJG(Z) returns the conjugate of Z.  If Z is (x, y) then the result is (x, -y)

Standard:
     F77 and later, has overloads that are GNU extensions

Class:
     Elemental function

Syntax:
     Z = CONJG(Z)

Arguments:

     Z   The type shall be COMPLEX(*).

Return value:
     The return value is of type COMPLEX(*).

Example:

          program test_conjg
              complex :: z = (2.0, 3.0)
              complex(8) :: dz = (2.71_8, -3.14_8)
              z= conjg(z)
              print *, z
              dz = dconjg(dz)
              print *, dz
          end program test_conjg

Specific names:

     Name               Argument               Return type            Standard
     DCONJG(Z)   COMPLEX(8) Z    COMPLEX(8)      GNU extension

COS --- Cosine function
=======================

Description:
     COS(X) computes the cosine of X.

Standard:
     F77 and later, has overloads that are GNU extensions

Class:
     Elemental function

Syntax:
     X = COS(X)

Arguments:

     X   The type shall be REAL(*) or
     COMPLEX(*).

Return value:
     The return value is of type REAL(*) and it lies in the range  -1 \leq \cos (x) \leq 1.  The kind type parameter is the same as X.

Example:

          program test_cos
            real :: x = 0.0
            x = cos(x)
          end program test_cos

Specific names:

     Name              Argument              Return type         Standard
     DCOS(X)    REAL(8) X      REAL(8)      F77 and later
     CCOS(X)    COMPLEX(4) X   COMPLEX(4)   F77 and later
     ZCOS(X)    COMPLEX(8) X   COMPLEX(8)   GNU extension
     CDCOS(X)   COMPLEX(8) X   COMPLEX(8)   GNU extension

See also:
     Inverse function: ACOS

COSH --- Hyperbolic cosine function
===================================

Description:
     COSH(X) computes the hyperbolic cosine of X.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = COSH(X)

Arguments:

     X   The type shall be REAL(*).

Return value:
     The return value is of type REAL(*) and it is positive ( \cosh (x) \geq 0 .

Example:

          program test_cosh
            real(8) :: x = 1.0_8
            x = cosh(x)
          end program test_cosh

Specific names:

     Name              Argument            Return type         Standard
     DCOSH(X)   REAL(8) X    REAL(8)      F77 and later

See also:
     Inverse function: ACOSH

COUNT --- Count function
========================

Description:
     COUNT(MASK[,DIM]) counts the number of .TRUE. elements of MASK along the dimension of DIM.  If DIM is omitted it is taken to be 1.  DIM is a scaler of type INTEGER in the range of 1 /leq DIM /leq n) where n is the rank of MASK.

Standard:
     F95 and later

Class:
     transformational function

Syntax:
     I = COUNT(MASK[,DIM])

Arguments:

     MASK   The type shall be LOGICAL.
     DIM    The type shall be INTEGER.

Return value:
     The return value is of type INTEGER with rank equal to that of MASK.

Example:

          program test_count
              integer, dimension(2,3) :: a, b
              logical, dimension(2,3) :: mask
              a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
              b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
              print '(3i3)', a(1,:)
              print '(3i3)', a(2,:)
              print *
              print '(3i3)', b(1,:)
              print '(3i3)', b(2,:)
              print *
              mask = a.ne.b
              print '(3l3)', mask(1,:)
              print '(3l3)', mask(2,:)
              print *
              print '(3i3)', count(mask)
              print *
              print '(3i3)', count(mask, 1)
              print *
              print '(3i3)', count(mask, 2)
          end program test_count

CPU_TIME --- CPU elapsed time in seconds
========================================

Description:
     Returns a REAL value representing the elapsed CPU time in seconds.  This is useful for testing segments of code to determine execution time.

Standard:
     F95 and later

Class:
     Subroutine

Syntax:
     CPU_TIME(X)

Arguments:

     X   The type shall be REAL with INTENT(OUT).

Return value:
     None

Example:

          program test_cpu_time
              real :: start, finish
              call cpu_time(start)
                  ! put code to test here
              call cpu_time(finish)
              print '("Time = ",f6.3," seconds.")',finish-start
          end program test_cpu_time

CSHIFT --- Circular shift function
==================================

Description:
     CSHIFT(ARRAY, SHIFT[,DIM]) performs a circular shift on elements of ARRAY along the dimension of DIM.  If DIM is omitted it is taken to be 1.  DIM is a scaler of type INTEGER in the range of 1 /leq DIM /leq n) where n is the rank of ARRAY. If the rank of ARRAY is one, then all elements of ARRAY are shifted by SHIFT places.  If rank is greater than one, then all complete rank one sections of ARRAY along the given dimension are shifted.  Elements shifted out one end of each rank one section are shifted back in the other end.

Standard:
     F95 and later

Class:
     transformational function

Syntax:
     A = CSHIFT(A, SHIFT[,DIM])

Arguments:

     ARRAY    May be any type, not scaler.
     SHIFT    The type shall be INTEGER.
     DIM      The type shall be INTEGER.

Return value:
     Returns an array of same type and rank as the ARRAY argument.

Example:

          program test_cshift
              integer, dimension(3,3) :: a
              a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
              print '(3i3)', a(1,:)
              print '(3i3)', a(2,:)
              print '(3i3)', a(3,:)
              a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
              print *
              print '(3i3)', a(1,:)
              print '(3i3)', a(2,:)
              print '(3i3)', a(3,:)
          end program test_cshift

CTIME --- Convert a time into a string
======================================

Description:
     CTIME(T,S) converts T, a system time value, such as returned by TIME8(), to a string of the form Sat Aug 19 18:13:14 1995, and returns that string into S.

     If CTIME is invoked as a function, it can not be invoked as a subroutine, and vice versa.

     T is an INTENT(IN) INTEGER(KIND=8) variable. S is an INTENT(OUT) CHARACTER variable.

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

     CALL CTIME(T,S).
     S = CTIME(T), (not recommended).

Arguments:

     S  The type shall be of type CHARACTER.
     T  The type shall be of type INTEGER(KIND=8).

Return value:
     The converted date and time as a string.

Example:

          program test_ctime
              integer(8) :: i
              character(len=30) :: date
              i = time8()

              ! Do something, main part of the program

              call ctime(i,date)
              print *, 'Program was started on ', date
          end program test_ctime

DATE_AND_TIME --- Date and time subroutine
==========================================

Description:
     DATE_AND_TIME(DATE, TIME, ZONE, VALUES) gets the corresponding date and time information from the real-time system clock.  DATE is INTENT(OUT) and has form ccyymmdd.  TIME is INTENT(OUT) and has form hhmmss.sss.  ZONE is INTENT(OUT) and has form (+-)hhmm, representing the difference with respect to Coordinated Universal Time (UTC). Unavailable time and date parameters return blanks.

     VALUES is INTENT(OUT) and provides the following:

       VALUE(1):   The year
       VALUE(2):   The month
       VALUE(3):   The day of the month
       VALUE(4):   Time difference with UTC in minutes
       VALUE(5):   The hour of the day
       VALUE(6):   The minutes of the hour
       VALUE(7):   The seconds of the minute
       VALUE(8):   The milliseconds of the second

Standard:
     F95 and later

Class:
     Subroutine

Syntax:
     CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])

Arguments:

     DATE    (Optional) The type shall be CHARACTER(8) or larger.
     TIME    (Optional) The type shall be CHARACTER(10) or larger.
     ZONE    (Optional) The type shall be CHARACTER(5) or larger.
     VALUES  (Optional) The type shall be INTEGER(8).

Return value:
     None

Example:

          program test_time_and_date
              character(8)  :: date
              character(10) :: time
              character(5)  :: zone
              integer,dimension(8) :: values
              ! using keyword arguments
              call date_and_time(date,time,zone,values)
              call date_and_time(DATE=date,ZONE=zone)
              call date_and_time(TIME=time)
              call date_and_time(VALUES=values)
              print '(a,2x,a,2x,a)', date, time, zone
              print '(8i5))', values
          end program test_time_and_date

DBLE --- Double conversion function
===================================

Description:
     DBLE(X) Converts X to double precision real type.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = DBLE(X)

Arguments:

     X   The type shall be INTEGER(*), REAL(*), or COMPLEX(*).

Return value:
     The return value is of type double precision real.

Example:

          program test_dble
              real    :: x = 2.18
              integer :: i = 5
              complex :: z = (2.3,1.14)
              print *, dble(x), dble(i), dble(z)
          end program test_dble

See also:
     DFLOAT, FLOAT, REAL

DCMPLX --- Double complex conversion function
=============================================

Description:
     DCMPLX(X [,Y]) returns a double complex number where X is converted to the real component.  If Y is present it is converted to the imaginary component.  If Y is not present then the imaginary component is set to 0.0.  If X is complex then Y must not be present.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     C = DCMPLX(X) C = DCMPLX(X,Y)

Arguments:

     X   The type may be INTEGER(*), REAL(*), or COMPLEX(*).
     Y   Optional if X is not COMPLEX(*). May be INTEGER(*) or REAL(*).

Return value:
     The return value is of type COMPLEX(8)

Example:

          program test_dcmplx
              integer :: i = 42
              real :: x = 3.14
              complex :: z
              z = cmplx(i, x)
              print *, dcmplx(i)
              print *, dcmplx(x)
              print *, dcmplx(z)
              print *, dcmplx(x,i)
          end program test_dcmplx

DFLOAT --- Double conversion function
=====================================

Description:
     DFLOAT(X) Converts X to double precision real type.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = DFLOAT(X)

Arguments:

     X   The type shall be INTEGER(*).

Return value:
     The return value is of type double precision real.

Example:

          program test_dfloat
              integer :: i = 5
              print *, dfloat(i)
          end program test_dfloat

See also:
     DBLE, FLOAT, REAL

DIGITS --- Significant digits function
======================================

Description:
     DIGITS(X) returns the number of significant digits of the internal model representation of X.  For example, on a system using a 32-bit floating point representation, a default real number would likely return 24.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     C = DIGITS(X)

Arguments:

     X   The type may be INTEGER(*) or REAL(*).

Return value:
     The return value is of type INTEGER.

Example:

          program test_digits
              integer :: i = 12345
              real :: x = 3.143
              real(8) :: y = 2.33
              print *, digits(i)
              print *, digits(x)
              print *, digits(y)
          end program test_digits

DIM --- Dim function
====================

Description:
     DIM(X,Y) returns the difference X-Y if the result is positive; otherwise returns zero.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = DIM(X,Y)

Arguments:

     X   The type shall be INTEGER(*) or REAL(*)
     Y   The type shall be the same type and kind as X.

Return value:
     The return value is of type INTEGER(*) or REAL(*).

Example:

          program test_dim
              integer :: i
              real(8) :: x
              i = dim(4, 15)
              x = dim(4.345_8, 2.111_8)
              print *, i
              print *, x
          end program test_dim

Specific names:

     Name               Argument                Return type         Standard
     IDIM(X,Y)   INTEGER(4) X,Y   INTEGER(4)   F77 and later
     DDIM(X,Y)   REAL(8) X,Y      REAL(8)      F77 and later

DOT_PRODUCT --- Dot product function
====================================

Description:
     DOT_PRODUCT(X,Y) computes the dot product multiplication of two vectors X and Y.  The two vectors may be either numeric or logical and must be arrays of rank one and of equal size. If the vectors are INTEGER(*) or REAL(*), the result is SUM(X*Y). If the vectors are COMPLEX(*), the result is SUM(CONJG(X)*Y). If the vectors are LOGICAL, the result is ANY(X.AND.Y).

Standard:
     F95 and later

Class:
     transformational function

Syntax:
     S = DOT_PRODUCT(X,Y)

Arguments:

     X   The type shall be numeric or LOGICAL, rank 1.
     Y   The type shall be numeric or LOGICAL, rank 1.

Return value:
     If the arguments are numeric, the return value is a scaler of numeric type, INTEGER(*), REAL(*), or COMPLEX(*).  If the arguments are LOGICAL, the return value is .TRUE. or .FALSE..

Example:

          program test_dot_prod
              integer, dimension(3) :: a, b
              a = (/ 1, 2, 3 /)
              b = (/ 4, 5, 6 /)
              print '(3i3)', a
              print *
              print '(3i3)', b
              print *
              print *, dot_product(a,b)
          end program test_dot_prod

DPROD --- Double product function
=================================

Description:
     DPROD(X,Y) returns the product X*Y.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     D = DPROD(X,Y)

Arguments:

     X   The type shall be REAL.
     Y   The type shall be REAL.

Return value:
     The return value is of type REAL(8).

Example:

          program test_dprod
              integer :: i
              real :: x = 5.2
              real :: y = 2.3
              real(8) :: d
              d = dprod(x,y)
              print *, d
          end program test_dprod

DREAL --- Double real part function
===================================

Description:
     DREAL(Z) returns the real part of complex variable Z.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     D = DREAL(Z)

Arguments:

     Z   The type shall be COMPLEX(8).

Return value:
     The return value is of type REAL(8).

Example:

          program test_dreal
              complex(8) :: z = (1.3_8,7.2_8)
              print *, dreal(z)
          end program test_dreal

See also:
     AIMAG

DTIME --- Execution time subroutine (or function)
=================================================

Description:
     DTIME(TARRAY, RESULT) initially returns the number of seconds of runtime since the start of the process's execution in RESULT.  TARRAY returns the user and system components of this time in TARRAY(1) and TARRAY(2) respectively. RESULT is equal to TARRAY(1) + TARRAY(2).

     Subsequent invocations of DTIME return values accumulated since the previous invocation.

     On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wrap around) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

     If DTIME is invoked as a function, it can not be invoked as a subroutine, and vice versa.

     TARRAY and RESULT are INTENT(OUT) and provide the following:

       TARRAY(1):   User time in seconds.
       TARRAY(2):   System time in seconds.
       RESULT:   Run time since start in seconds.

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

     CALL DTIME(TARRAY, RESULT).
     RESULT = DTIME(TARRAY), (not recommended).

Arguments:

     TARRAY  The type shall be REAL, DIMENSION(2).
     RESULT  The type shall be REAL.

Return value:
     Elapsed time in seconds since the start of program execution.

Example:

          program test_dtime
              integer(8) :: i, j
              real, dimension(2) :: tarray
              real :: result
              call dtime(tarray, result)
              print *, result
              print *, tarray(1)
              print *, tarray(2)
              do i=1,100000000    ! Just a delay
                  j = i * i - i
              end do
              call dtime(tarray, result)
              print *, result
              print *, tarray(1)
              print *, tarray(2)
          end program test_dtime

EOSHIFT --- End-off shift function
==================================

Description:
     EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM]) performs an end-off shift on elements of ARRAY along the dimension of DIM.  If DIM is omitted it is taken to be 1.  DIM is a scaler of type INTEGER in the range of 1 /leq DIM /leq n) where n is the rank of ARRAY.  If the rank of ARRAY is one, then all elements of ARRAY are shifted by SHIFT places.  If rank is greater than one, then all complete rank one sections of ARRAY along the given dimension are shifted.  Elements shifted out one end of each rank one section are dropped.  If BOUNDARY is present then the corresponding value of from BOUNDARY is copied back in the other end.  If BOUNDARY is not present then the following are copied in depending on the type of ARRAY.

     Array Type   Boundary Value
     Numeric    0 of the type and kind of ARRAY.
     Logical    .FALSE..
     Character(LEN)   LEN blanks.

Standard:
     F95 and later

Class:
     transformational function

Syntax:
     A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])

Arguments:

     ARRAY    May be any type, not scaler.
     SHIFT    The type shall be INTEGER.
     BOUNDARY   Same type as ARRAY.
     DIM      The type shall be INTEGER.

Return value:
     Returns an array of same type and rank as the ARRAY argument.

Example:

          program test_eoshift
              integer, dimension(3,3) :: a
              a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
              print '(3i3)', a(1,:)
              print '(3i3)', a(2,:)
              print '(3i3)', a(3,:)
              a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
              print *
              print '(3i3)', a(1,:)
              print '(3i3)', a(2,:)
              print '(3i3)', a(3,:)
          end program test_eoshift

EPSILON --- Epsilon function
============================

Description:
     EPSILON(X) returns a nearly negligible number relative to 1.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     C = EPSILON(X)

Arguments:

     X   The type shall be REAL(*).

Return value:
     The return value is of same type as the argument.

Example:

          program test_epsilon
              real :: x = 3.143
              real(8) :: y = 2.33
              print *, EPSILON(x)
              print *, EPSILON(y)
          end program test_epsilon

ERF --- Error function
======================

Description:
     ERF(X) computes the error function of X.

Standard:
     GNU Extension

Class:
     Elemental function

Syntax:
     X = ERF(X)

Arguments:

     X   The type shall be REAL(*), and it shall be scalar.

Return value:
     The return value is a scalar of type REAL(*) and it is positive ( - 1 \leq erf (x) \leq 1 .

Example:

          program test_erf
            real(8) :: x = 0.17_8
            x = erf(x)
          end program test_erf

Specific names:

     Name              Argument            Return type         Standard
     DERF(X)    REAL(8) X    REAL(8)      GNU extension

ERFC --- Error function
=======================

Description:
     ERFC(X) computes the complementary error function of X.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = ERFC(X)

Arguments:

     X   The type shall be REAL(*), and it shall be scalar.

Return value:
     The return value is a scalar of type REAL(*) and it is positive ( 0 \leq erfc (x) \leq 2 .

Example:

          program test_erfc
            real(8) :: x = 0.17_8
            x = erfc(x)
          end program test_erfc

Specific names:

     Name              Argument            Return type         Standard
     DERFC(X)   REAL(8) X    REAL(8)      GNU extension

ETIME --- Execution time subroutine (or function)
=================================================

Description:
     ETIME(TARRAY, RESULT) returns the number of seconds of runtime since the start of the process's execution in RESULT.  TARRAY returns the user and system components of this time in TARRAY(1) and TARRAY(2) respectively. RESULT is equal to TARRAY(1) + TARRAY(2).

     On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wrap around) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

     If ETIME is invoked as a function, it can not be invoked as a subroutine, and vice versa.

     TARRAY and RESULT are INTENT(OUT) and provide the following:

       TARRAY(1):   User time in seconds.
       TARRAY(2):   System time in seconds.
       RESULT:   Run time since start in seconds.

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

     CALL ETIME(TARRAY, RESULT).
     RESULT = ETIME(TARRAY), (not recommended).

Arguments:

     TARRAY  The type shall be REAL, DIMENSION(2).
     RESULT  The type shall be REAL.

Return value:
     Elapsed time in seconds since the start of program execution.

Example:

          program test_etime
              integer(8) :: i, j
              real, dimension(2) :: tarray
              real :: result
              call ETIME(tarray, result)
              print *, result
              print *, tarray(1)
              print *, tarray(2)
              do i=1,100000000    ! Just a delay
                  j = i * i - i
              end do
              call ETIME(tarray, result)
              print *, result
              print *, tarray(1)
              print *, tarray(2)
          end program test_etime

See also:
     CPU_TIME

EXIT --- Exit the program with status.
======================================

Description:
     EXIT causes immediate termination of the program with status.  If status is omitted it returns the canonical success for the system.  All Fortran I/O units are closed.

Standard:
     GNU extension

Class:
     Subroutine

Syntax:
     CALL EXIT([STATUS])

Arguments:

     STATUS   The type of the argument shall be INTEGER(*).

Return value:
     STATUS is passed to the parent process on exit.

Example:

          program test_exit
            integer :: STATUS = 0
            print *, 'This program is going to exit.'
            call EXIT(STATUS)
          end program test_exit

See also:
     ABORT, KILL

EXP --- Exponential function
============================

Description:
     EXP(X) computes the base e exponential of X.

Standard:
     F77 and later, has overloads that are GNU extensions

Class:
     Elemental function

Syntax:
     X = EXP(X)

Arguments:

     X   The type shall be REAL(*) or
     COMPLEX(*).

Return value:
     The return value has same type and kind as X.

Example:

          program test_exp
            real :: x = 1.0
            x = exp(x)
          end program test_exp

Specific names:

     Name              Argument               Return type           Standard
     DEXP(X)    REAL(8) X       REAL(8)        F77 and later
     CEXP(X)    COMPLEX(4) X    COMPLEX(4)     F77 and later
     ZEXP(X)    COMPLEX(8) X    COMPLEX(8)     GNU extension
     CDEXP(X)   COMPLEX(8) X    COMPLEX(8)     GNU extension

EXPONENT --- Exponent function
==============================

Description:
     EXPONENT(X) returns the value of the exponent part of X. If X is zero the value returned is zero.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     I = EXPONENT(X)

Arguments:

     X   The type shall be REAL(*).

Return value:
     The return value is of type default INTEGER.

Example:

          program test_exponent
            real :: x = 1.0
            integer :: i
            i = exponent(x)
            print *, i
            print *, exponent(0.0)
          end program test_exponent

FDATE --- Get the current time as a string
==========================================

Description:
     FDATE(DATE) returns the current date (using the same format as CTIME) in DATE. It is equivalent to CALL CTIME(DATE, TIME8()).

     If FDATE is invoked as a function, it can not be invoked as a subroutine, and vice versa.

     DATE is an INTENT(OUT) CHARACTER variable.

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

     CALL FDATE(DATE).
     DATE = FDATE(), (not recommended).

Arguments:

     DATE  The type shall be of type CHARACTER.

Return value:
     The current date and time as a string.

Example:

          program test_fdate
              integer(8) :: i, j
              character(len=30) :: date
              call fdate(date)
              print *, 'Program started on ', date
              do i = 1, 100000000 ! Just a delay
                  j = i * i - i
              end do
              call fdate(date)
              print *, 'Program ended on ', date
          end program test_fdate

FLOAT --- Convert integer to default real
=========================================

Description:
     FLOAT(I) converts the integer I to a default real value.

Standard:
     GNU extension

Class:
     Elemental function

Syntax:
     X = FLOAT(I)

Arguments:

     I   The type shall be INTEGER(*).

Return value:
     The return value is of type default REAL

Example:

          program test_float
              integer :: i = 1
              if (float(i) /= 1.) call abort
          end program test_float

See also:
     DBLE, DFLOAT, REAL

FGET --- Read a single character in stream mode from stdin
==========================================================

Description:
     Read a single character in stream mode from stdin by bypassing normal formatted output. Stream I/O should not be mixed with normal record-oriented (formatted or unformatted) I/O on the same unit; the results are unpredictable.

     This intrinsic routine is provided for backwards compatibility with GNU Fortran 77.  Gfortran provides the Fortran 2003 Stream facility. Programmers should consider the use of new stream IO feature in new code for future portability. See also Fortran 2003 status.

Standard:
     GNU extension

Class:
     Non-elemental subroutine

Syntax:
     CALL fget(C[,STATUS])

Arguments:

     C        The type shall be CHARACTER.
     STATUS   (Optional) status flag of type INTEGER. Returns 0 on success,
     -1 on end-of-file and a system specific positive error code otherwise.

Example:

          PROGRAM test_fget
            INTEGER, PARAMETER :: strlen = 100
            INTEGER :: status, i = 1
            CHARACTER(len=strlen) :: str = ""

            WRITE (*,*) 'Enter text:'
            DO
              CALL fget(str(i:i), status)
              if (status /= 0 .OR. i > strlen) exit
              i = i + 1
            END DO
            WRITE (*,*) TRIM(str)
          END PROGRAM

See also:
     FGETC, FPUT, FPUTC

FGETC --- Read a single character in stream mode
================================================

Description:
     Read a single character in stream mode by bypassing normal formatted output. Stream I/O should not be mixed with normal record-oriented (formatted or unformatted) I/O on the same unit; the results are unpredictable.

     This intrinsic routine is provided for backwards compatibility with GNU Fortran 77.  Gfortran provides the Fortran 2003 Stream facility. Programmers should consider the use of new stream IO feature in new code for future portability. See also Fortran 2003 status.

Standard:
     GNU extension

Class:
     Non-elemental subroutine

Syntax:
     CALL fgetc(UNIT,C[,STATUS])

Arguments:

     UNIT     The type shall be INTEGER.
     C        The type shall be CHARACTER.
     STATUS   (Optional) status flag of type INTEGER. Returns 0 on success,
     -1 on end-of-file and a system specific positive error code otherwise.

Example:

          PROGRAM test_fgetc
            INTEGER :: fd = 42, status
            CHARACTER :: c

            OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
            DO
              CALL fgetc(fd, c, status)
              IF (status /= 0) EXIT
              call fput(c)
            END DO
            CLOSE(UNIT=fd)
          END PROGRAM

See also:
     FGET, FPUT, FPUTC

FLOOR --- Integer floor function
================================

Description:
     FLOOR(X) returns the greatest integer less than or equal to X.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     I = FLOOR(X[,KIND])

Arguments:

     X   The type shall be REAL(*).
     KIND   Optional scaler integer initialization expression.

Return value:
     The return value is of type INTEGER(KIND)

Example:

          program test_floor
              real :: x = 63.29
              real :: y = -63.59
              print *, floor(x) ! returns 63
              print *, floor(y) ! returns -64
          end program test_floor

See also:
     CEILING, NINT

FLUSH --- Flush I/O unit(s)
===========================

Description:
     Flushes Fortran unit(s) currently open for output. Without the optional argument, all units are flushed, otherwise just the unit specified.

Standard:
     GNU extension

Class:
     non-elemental subroutine

Syntax:
     CALL FLUSH(UNIT)

Arguments:

     UNIT   (Optional) The type shall be INTEGER.

Note:
     Beginning with the Fortran 2003 standard, there is a FLUSH statement that should be preferred over the FLUSH intrinsic.

FNUM --- File number function
=============================

Description:
     FNUM(UNIT) returns the POSIX file descriptor number corresponding to the open Fortran I/O unit UNIT.

Standard:
     GNU extension

Class:
     non-elemental function

Syntax:
     I = FNUM(UNIT)

Arguments:

     UNIT   The type shall be INTEGER.

Return value:
     The return value is of type INTEGER

Example:

          program test_fnum
            integer :: i
            open (unit=10, status = "scratch")
            i = fnum(10)
            print *, i
            close (10)
          end program test_fnum

FPUT --- Write a single character in stream mode to stdout
==========================================================

Description:
     Write a single character in stream mode to stdout by bypassing normal formatted output. Stream I/O should not be mixed with normal record-oriented (formatted or unformatted) I/O on the same unit; the results are unpredictable.

     This intrinsic routine is provided for backwards compatibility with GNU Fortran 77.  Gfortran provides the Fortran 2003 Stream facility. Programmers should consider the use of new stream IO feature in new code for future portability. See also Fortran 2003 status.

Standard:
     GNU extension

Class:
     Non-elemental subroutine

Syntax:
     CALL fput(C[,STATUS])

Arguments:

     C        The type shall be CHARACTER.
     STATUS   (Optional) status flag of type INTEGER. Returns 0 on success,
     -1 on end-of-file and a system specific positive error code otherwise.

Example:

          PROGRAM test_fput
            CHARACTER(len=*) :: str = "gfortran"
            INTEGER :: i
            DO i = 1, len_trim(str)
              CALL fput(str(i:i))
            END DO
          END PROGRAM

See also:
     FPUTC, FGET, FGETC

FPUTC --- Write a single character in stream mode
=================================================

Description:
     Write a single character in stream mode by bypassing normal formatted output. Stream I/O should not be mixed with normal record-oriented (formatted or unformatted) I/O on the same unit; the results are unpredictable.

     This intrinsic routine is provided for backwards compatibility with GNU Fortran 77.  Gfortran provides the Fortran 2003 Stream facility. Programmers should consider the use of new stream IO feature in new code for future portability. See also Fortran 2003 status.

Standard:
     GNU extension

Class:
     Non-elemental subroutine

Syntax:
     CALL fputc(UNIT,C[,STATUS])

Arguments:

     UNIT     The type shall be INTEGER.
     C        The type shall be CHARACTER.
     STATUS   (Optional) status flag of type INTEGER. Returns 0 on success,
     -1 on end-of-file and a system specific positive error code otherwise.

Example:

          PROGRAM test_fputc
            CHARACTER(len=*) :: str = "gfortran"
            INTEGER :: fd = 42, i

            OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
            DO i = 1, len_trim(str)
              CALL fputc(fd, str(i:i))
            END DO
            CLOSE(fd)
          END PROGRAM

See also:
     FPUT, FGET, FGETC

FRACTION --- Fractional part of the model representation
========================================================

Description:
     FRACTION(X) returns the fractional part of the model representation of X.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     Y = FRACTION(X)

Arguments:

     X   The type of the argument shall be a REAL.

Return value:
     The return value is of the same type and kind as the argument. The fractional part of the model representation of X is returned; it is X * RADIX(X)**(-EXPONENT(X)).

Example:

          program test_fraction
            real :: x
            x = 178.1387e-4
            print *, fraction(x), x * radix(x)**(-exponent(x))
          end program test_fraction

FREE --- Frees memory
=====================

Description:
     Frees memory previously allocated by MALLOC(). The FREE intrinsic is an extension intended to be used with Cray pointers, and is provided in gfortran to allow user to compile legacy code. For new code using Fortran 95 pointers, the memory de-allocation intrinsic is DEALLOCATE.

Standard:
     GNU extension

Class:
     Subroutine

Syntax:
     FREE(PTR)

Arguments:

     PTR   The type shall be INTEGER. It represents the
     location of the memory that should be de-allocated.

Return value:
     None

Example:
     See MALLOC for an example.

See also:
     MALLOC

FSTAT --- Get file status
=========================

Intrinsic implemented, documentation pending.

Description:
     GNU extension

Standard:

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

FSEEK --- Low level file positioning subroutine
===============================================

Not yet implemented in gfortran.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     g77 features lacking in gfortran (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292)

FTELL --- Current stream position
=================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

GETARG --- Get command line arguments
=====================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     IARGC, GET_COMMAND, GET_COMMAND_ARGUMENT

GET_COMMAND --- Subroutine to retrieve the entire command line
==============================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F2003

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

GET_COMMAND_ARGUMENT --- Subroutine to retrieve a command argument
==================================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F2003

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     COMMAND_ARGUMENT_COUNT

GETCWD --- Get current working directory
========================================

Description:
     Get current working directory.

Standard:
     GNU extension

Class:
     Non-elemental subroutine.

Syntax:
     CALL getcwd(CWD[,STATUS])

Arguments:

     CWD      The type shall be CHARACTER(*).
     STATUS   (Optional) status flag. Returns 0 on success,
     a system specific and non-zero error code otherwise.

Example:

          PROGRAM test_getcwd
            CHARACTER(len=255) :: cwd
            CALL getcwd(cwd)
            WRITE(*,*) TRIM(cwd)
          END PROGRAM

See also:
     CHDIR

GETENV --- Get an environmental variable
========================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     GET_ENVIRONMENT_VARIABLE

GET_ENVIRONMENT_VARIABLE --- Get an environmental variable
==========================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F2003

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

GETGID --- Group ID function
============================

Description:
     Returns the numerical group ID of the current process.

Standard:
     GNU extension

Class:
     function

Syntax:
     I = GETGID()

Return value:
     The return value of GETGID is an INTEGER of the default kind.

Example:
     See GETPID for an example.

See also:
     GETPID

GETLOG --- Get login name
=========================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

GETPID --- Process ID function
==============================

Description:
     Returns the numerical process identifier of the current process.

Standard:
     GNU extension

Class:
     function

Syntax:
     I = GETPID()

Return value:
     The return value of GETPID is an INTEGER of the default kind.

Example:

          program info
            print *, "The current process ID is ", getpid()
            print *, "Your numerical user ID is ", getuid()
            print *, "Your numerical group ID is ", getgid()
          end program info

GETUID --- User ID function
===========================

Description:
     Returns the numerical user ID of the current process.

Standard:
     GNU extension

Class:
     function

Syntax:
     GETUID()

Return value:
     The return value of GETUID is an INTEGER of the default kind.

Example:
     See GETPID for an example.

See also:
     GETPID

GMTIME --- Convert time to GMT info
===================================

Not yet implemented in gfortran.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     g77 features lacking in gfortran (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292)

HOSTNM --- Get system host name
===============================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

HUGE --- Largest number of a kind
=================================

Description:
     HUGE(X) returns the largest number that is not an infinity in the model of the type of X.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     Y = HUGE(X)

Arguments:

     X   shall be of type REAL or INTEGER.

Return value:
     The return value is of the same type and kind as X

Example:

          program test_huge_tiny
            print *, huge(0), huge(0.0), huge(0.0d0)
            print *, tiny(0.0), tiny(0.0d0)
          end program test_huge_tiny

IACHAR --- Code in ASCII collating sequence
===========================================

Description:
     IACHAR(C) returns the code for the ASCII character in the first character position of C.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     I = IACHAR(C)

Arguments:

     C   Shall be a scalar CHARACTER, with INTENT(IN)

Return value:
     The return value is of type INTEGER and of the default integer kind.

Example:

          program test_iachar
            integer i
            i = iachar(' ')
          end program test_iachar

See also:
     CHAR,ICHAR

IAND --- Bitwise logical and
============================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     IOR, IEOR, IBITS, IBSET, IBCLR,

IARGC --- Get number of command line arguments
==============================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     GETARG, GET_COMMAND, COMMAND_ARGUMENT_COUNT, GET_COMMAND_ARGUMENT

IBCLR --- Clear bit
===================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     IBITS, IBSET, IAND, IOR, IEOR

IBITS --- Bit extraction
========================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     IBCLR, IBSET, IAND, IOR, IEOR

IBSET --- Set bit
=================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     IBCLR, IBITS, IAND, IOR, IEOR

ICHAR --- Character-to-integer conversion function
==================================================

Description:
     ICHAR(C) returns the code for the character in the first character position of C in the system's native character set. The correspondence between characters and their codes is not necessarily the same across different GNU Fortran implementations.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     I = ICHAR(C)

Arguments:

     C   Shall be a scalar CHARACTER, with INTENT(IN)

Return value:
     The return value is of type INTEGER and of the default integer kind.

Example:

          program test_ichar
            integer i
            i = ichar(' ')
          end program test_ichar

Note:
     No intrinsic exists to convert a printable character string to a numerical value. For example, there is no intrinsic that, given the CHARACTER value 154, returns an INTEGER or REAL value with the value 154.

     Instead, you can use internal-file I/O to do this kind of conversion. For example:

          program read_val
            integer value
            character(len=10) string

            string = '154'
            read (string,'(I10)') value
            print *, value
          end program read_val

IDATE --- Get current local time subroutine (day/month/year)
============================================================

Description:
     IDATE(TARRAY) Fills TARRAY with the numerical values at the current local time. The day (in the range 1-31), month (in the range 1-12), and year appear in elements 1, 2, and 3 of TARRAY, respectively. The year has four significant digits.

Standard:
     GNU extension

Class:
     Subroutine

Syntax:
     CALL IDATE(TARRAY)

Arguments:

     TARRAY   The type shall be INTEGER, DIMENSION(3) and
     the kind shall be the default integer kind.

Return value:
     Does not return.

Example:

          program test_idate
            integer, dimension(3) :: tarray
            call idate(tarray)
            print *, tarray(1)
            print *, tarray(2)
            print *, tarray(3)
          end program test_idate

IEOR --- Bitwise logical exclusive or
=====================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     IOR, IAND, IBITS, IBSET, IBCLR,

IERRNO --- Get the last system error number
===========================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:

Syntax:

Arguments:

Return value:

Example:

See also:
     PERROR

INDEX --- Position of a substring within a string
=================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

INT --- Convert to integer type
===============================

Description:
     Convert to integer type

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

     X = INT(X)
     X = INT(X, KIND)

Arguments:

     X   shall be of type INTEGER(*), REAL(*) or COMPLEX(*)
     KIND    (Optional) KIND shall be a scalar integer.

Return value:
     These functions return a INTEGER(*) variable or array under the following rules:

     (A)
          If X is of type INTEGER(*), INT(X) = X

     (B)
          If X is of type REAL(*) and |X| < 1 INT(X) equals 0.
          If |X| \geq 1, then INT(X) equals the largest integer that does not exceed
          the range of X and whose sign is the same as the sign of X.

     (C)
          If X is of type COMPLEX(*), rule B is applied to the real part of X.

Example:

          program test_int
            integer :: i = 42
            complex :: z = (-3.7, 1.0)
            print *, int(i)
            print *, int(z), int(z,8)
          end program

Specific names:

     Name               Argument              Return type         Standard
     IFIX(X)     REAL(4) X      INTEGER      F77 and later
     IDINT(X)    REAL(8) X      INTEGER      F77 and later

IOR --- Bitwise logical or
==========================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     IEOR, IAND, IBITS, IBSET, IBCLR,

IRAND --- Integer pseudo-random number
======================================

Description:
     IRAND(FLAG) returns a pseudo-random number from a uniform distribution between 0 and a system-dependent limit (which is in most cases 2147483647). If FLAG is 0, the next number in the current sequence is returned; if FLAG is 1, the generator is restarted by CALL SRAND(0); if FLAG has any other value, it is used as a new seed with SRAND.

Standard:
     GNU extension

Class:
     non-elemental function

Syntax:
     I = IRAND(FLAG)

Arguments:

     FLAG   shall be a scalar INTEGER of kind 4.

Return value:
     The return value is of INTEGER(kind=4) type.

Example:

          program test_irand
            integer,parameter :: seed = 86456

            call srand(seed)
            print *, irand(), irand(), irand(), irand()
            print *, irand(seed), irand(), irand(), irand()
          end program test_irand

ISHFT --- Shift bits
====================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     ISHFTC

ISHFTC --- Shift bits circularly
================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     ISHFT

ITIME --- Get current local time subroutine (hour/minutes/seconds)
==================================================================

Description:
     IDATE(TARRAY) Fills TARRAY with the numerical values at the current local time. The hour (in the range 1-24), minute (in the range 1-60), and seconds (in the range 1-60) appear in elements 1, 2, and 3 of TARRAY, respectively.

Standard:
     GNU extension

Class:
     Subroutine

Syntax:
     CALL ITIME(TARRAY)

Arguments:

     TARRAY   The type shall be INTEGER, DIMENSION(3)
     and the kind shall be the default integer kind.

Return value:
     Does not return.

Example:

          program test_itime
            integer, dimension(3) :: tarray
            call itime(tarray)
            print *, tarray(1)
            print *, tarray(2)
            print *, tarray(3)
          end program test_itime

KILL --- Send a signal to a process
===================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     ABORT, EXIT

KIND --- Kind of an entity
==========================

Description:
     KIND(X) returns the kind value of the entity X.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     K = KIND(X)

Arguments:

     X   Shall be of type LOGICAL, INTEGER,
     REAL, COMPLEX or CHARACTER.

Return value:
     The return value is a scalar of type INTEGER and of the default integer kind.

Example:

          program test_kind
            integer,parameter :: kc = kind(' ')
            integer,parameter :: kl = kind(.true.)

            print *, "The default character kind is ", kc
            print *, "The default logical kind is ", kl
          end program test_kind

LBOUND --- Lower dimension bounds of an array
=============================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:

Arguments:

Return value:

Example:

See also:
     UBOUND

LEN --- Length of a character entity
====================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F77 and later

Class:
     Inquiry function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     LEN_TRIM, ADJUSTL, ADJUSTR

LEN_TRIM --- Length of a character entity without trailing blank characters
===========================================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

See also:
     LEN, ADJUSTL, ADJUSTR

LGE --- Lexical greater than or equal
=====================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

See also:
     LGT, LLE, LLT

LGT --- Lexical greater than
============================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

See also:
     LGE, LLE, LLT

LINK --- Create a hard link
===========================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     UNLINK

LLE --- Lexical less than or equal
==================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

See also:
     LGE, LGT, LLT

LLT --- Lexical less than
=========================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

See also:
     LGE, LGT, LLE

LNBLNK --- Index of the last non-blank character in a string
============================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     INDEX

LOC --- Returns the address of a variable
=========================================

Description:
     LOC(X) returns the address of X as an integer.

Standard:
     GNU extension

Class:
     Inquiry function

Syntax:
     I = LOC(X)

Arguments:

     X   Variable of any type.

Return value:
     The return value is of type INTEGER(n), where n is the size (in bytes) of a memory address on the target machine.

Example:

          program test_loc
            integer :: i
            real :: r
            i = loc(r)
            print *, i
          end program test_loc

LOG --- Logarithm function
==========================

Description:
     LOG(X) computes the logarithm of X.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = LOG(X)

Arguments:

     X   The type shall be REAL(*) or
     COMPLEX(*).

Return value:
     The return value is of type REAL(*) or COMPLEX(*). The kind type parameter is the same as X.

Example:

          program test_log
            real(8) :: x = 1.0_8
            complex :: z = (1.0, 2.0)
            x = log(x)
            z = log(z)
          end program test_log

Specific names:

     Name              Argument            Return type         Standard
     ALOG(X)    REAL(4) X    REAL(4)      f95, gnu
     DLOG(X)    REAL(8) X    REAL(8)      f95, gnu
     CLOG(X)    COMPLEX(4) X    COMPLEX(4)      f95, gnu
     ZLOG(X)    COMPLEX(8) X    COMPLEX(8)      f95, gnu
     CDLOG(X)   COMPLEX(8) X    COMPLEX(8)      f95, gnu

LOG10 --- Base 10 logarithm function
====================================

Description:
     LOG10(X) computes the base 10 logarithm of X.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = LOG10(X)

Arguments:

     X   The type shall be REAL(*) or
     COMPLEX(*).

Return value:
     The return value is of type REAL(*) or COMPLEX(*). The kind type parameter is the same as X.

Example:

          program test_log10
            real(8) :: x = 10.0_8
            x = log10(x)
          end program test_log10

Specific names:

     Name              Argument            Return type         Standard
     ALOG10(X)    REAL(4) X    REAL(4)      F95 and later
     DLOG10(X)    REAL(8) X    REAL(8)      F95 and later

LOGICAL --- Convert to logical type
===================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

LSHIFT --- Left shift bits
==========================

Not yet implemented in gfortran.

Description:

Standard:
     GNU extension

Class:
     Function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     g77 features lacking in gfortran (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292)

LTIME --- Convert time to local time info
=========================================

Not yet implemented in gfortran.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     g77 features lacking in gfortran (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292)

MALLOC --- Allocate dynamic memory
==================================

Description:
     MALLOC(SIZE) allocates SIZE bytes of dynamic memory and returns the address of the allocated memory. The MALLOC intrinsic is an extension intended to be used with Cray pointers, and is provided in gfortran to allow user to compile legacy code. For new code using Fortran 95 pointers, the memory allocation intrinsic is ALLOCATE.

Standard:
     GNU extension

Class:
     non-elemental function

Syntax:
     PTR = MALLOC(SIZE)

Arguments:

     SIZE   The type shall be INTEGER(*).

Return value:
     The return value is of type INTEGER(K), with K such that variables of type INTEGER(K) have the same size as C pointers (sizeof(void *)).

Example:
     The following example demonstrates the use of MALLOC and FREE with Cray pointers. This example is intended to run on 32-bit systems, where the default integer kind is suitable to store pointers; on 64-bit systems, ptr_x would need to be declared as integer(kind=8).

          program test_malloc
            integer i
            integer ptr_x
            real*8 x(*), z
            pointer(ptr_x,x)

            ptr_x = malloc(20*8)
            do i = 1, 20
              x(i) = sqrt(1.0d0 / i)
            end do
            z = 0
            do i = 1, 20
              z = z + x(i)
              print *, z
            end do
            call free(ptr_x)
          end program test_malloc

See also:
     FREE

MATMUL --- matrix multiplication
================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:

MAX --- Maximum value of an argument list
=========================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

     Name               Argument              Return type           Standard
     MAX0(I)     INTEGER(4) I   INTEGER(4)     F77 and later
     AMAX0(I)    INTEGER(4) I   REAL(MAX(X))   F77 and later
     MAX1(X)     REAL(*) X      INT(MAX(X))    F77 and later
     AMAX1(X)    REAL(4)    X   REAL(4)        F77 and later
     DMAX1(X)    REAL(8)    X   REAL(8)        F77 and later

See also:
     MAXLOC MAXVAL

MAXEXPONENT --- Maximum exponent of a real kind
===============================================

Description:
     MAXEXPONENT(X) returns the maximum exponent in the model of the type of X.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     I = MAXEXPONENT(X)

Arguments:

     X   shall be of type REAL.

Return value:
     The return value is of type INTEGER and of the default integer kind.

Example:

          program exponents
            real(kind=4) :: x
            real(kind=8) :: y

            print *, minexponent(x), maxexponent(x)
            print *, minexponent(y), maxexponent(y)
          end program exponents

MAXLOC --- Location of the maximum value within an array
========================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:
     MAX, MAXVAL

MAXVAL --- Maximum value of an array
====================================

Intrinsic implemented, documentation pending.

Description:

Standard:

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     MAX, MAXLOC

MERGE --- Merge arrays
======================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

MIN --- Minimum value of an argument list
=========================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

     Name               Argument              Return type           Standard
     MIN0(I)     INTEGER(4) I   INTEGER(4)     F77 and later
     AMIN0(I)    INTEGER(4) I   REAL(MIN(X))   F77 and later
     MIN1(X)     REAL(*) X      INT(MIN(X))    F77 and later
     AMIN1(X)    REAL(4)    X   REAL(4)        F77 and later
     DMIN1(X)    REAL(8)    X   REAL(8)        F77 and later

See also:
     MINLOC, MINVAL

MINEXPONENT --- Minimum exponent of a real kind
===============================================

Description:
     MINEXPONENT(X) returns the minimum exponent in the model of the type of X.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     I = MINEXPONENT(X)

Arguments:

     X   shall be of type REAL.

Return value:
     The return value is of type INTEGER and of the default integer kind.

Example:
     See MAXEXPONENT for an example.

MINLOC --- Location of the minimum value within an array
========================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:
     MIN, MINVAL

MINVAL --- Minimum value of an array
====================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:
     MIN, MINLOC

MOD --- Remainder function
==========================

Description:
     MOD(A,P) computes the remainder of the division of A by P. It is calculated as A - (INT(A/P) * P).

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = MOD(A,P)

Arguments:

     A   shall be a scalar of type INTEGER or REAL
     P   shall be a scalar of the same type as A and not
     equal to zero

Return value:
     The kind of the return value is the result of cross-promoting the kinds of the arguments.

Example:

          program test_mod
            print *, mod(17,3)
            print *, mod(17.5,5.5)
            print *, mod(17.5d0,5.5)
            print *, mod(17.5,5.5d0)

            print *, mod(-17,3)
            print *, mod(-17.5,5.5)
            print *, mod(-17.5d0,5.5)
            print *, mod(-17.5,5.5d0)

            print *, mod(17,-3)
            print *, mod(17.5,-5.5)
            print *, mod(17.5d0,-5.5)
            print *, mod(17.5,-5.5d0)
          end program test_mod

Specific names:

     Name               Arguments        Return type      Standard
     AMOD(A,P)   REAL(4)   REAL(4)   F95 and later
     DMOD(A,P)   REAL(8)   REAL(8)   F95 and later

MODULO --- Modulo function
==========================

Description:
     MODULO(A,P) computes the A modulo P.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     X = MODULO(A,P)

Arguments:

     A   shall be a scalar of type INTEGER or REAL
     P   shall be a scalar of the same type and kind as A

Return value:
     The type and kind of the result are those of the arguments.

     If A and P are of type INTEGER:
          MODULO(A,P) has the value R such that A=Q*P+R, where Q is an integer and R is between 0 (inclusive) and P (exclusive).

     If A and P are of type REAL:
          MODULO(A,P) has the value of A - FLOOR (A / P) * P.

     In all cases, if P is zero the result is processor-dependent.

Example:

          program test_modulo
            print *, modulo(17,3)
            print *, modulo(17.5,5.5)

            print *, modulo(-17,3)
            print *, modulo(-17.5,5.5)

            print *, modulo(17,-3)
            print *, modulo(17.5,-5.5)
          end program test_mod

MVBITS --- Move bits from one integer to another
================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental subroutine

Syntax:

Arguments:

Return value:

Example:

See also:

NEAREST --- Nearest representable number
========================================

Description:
     NEAREST(X, S) returns the processor-representable number nearest to X in the direction indicated by the sign of S.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     Y = NEAREST(X, S)

Arguments:

     X   shall be of type REAL.
     S   (Optional) shall be of type REAL and
     not equal to zero.

Return value:
     The return value is of the same type as X. If S is positive, NEAREST returns the processor-representable number greater than X and nearest to it. If S is negative, NEAREST returns the processor-representable number smaller than X and nearest to it.

Example:

          program test_nearest
            real :: x, y
            x = nearest(42.0, 1.0)
            y = nearest(42.0, -1.0)
            write (*,"(3(G20.15))") x, y, x - y
          end program test_nearest

NINT --- Nearest whole number
=============================

Description:
     NINT(X) rounds its argument to the nearest whole number.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = NINT(X)

Arguments:

     X      The type of the argument shall be REAL.

Return value:
     Returns A with the fractional portion of its magnitude eliminated by rounding to the nearest whole number and with its sign preserved, converted to an INTEGER of the default kind.

Example:

          program test_nint
            real(4) x4
            real(8) x8
            x4 = 1.234E0_4
            x8 = 4.321_8
            print *, nint(x4), idnint(x8)
          end program test_nint

Specific names:

     Name               Argument           Standard
     IDNINT(X)   REAL(8)     F95 and later

See also:
     CEILING, FLOOR

NOT --- Logical negation
========================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

See also:

NULL --- Function that returns an disassociated pointer
=======================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:
     ASSOCIATED

OR --- Bitwise logical OR
=========================

Description:
     Bitwise logical OR.

     This intrinsic routine is provided for backwards compatibility with GNU Fortran 77.  For integer arguments, programmers should consider the use of the IOR intrinsic defined by the Fortran standard.

Standard:
     GNU extension

Class:
     Non-elemental function

Syntax:
     RESULT = OR(X, Y)

Arguments:

     X   The type shall be either INTEGER(*) or LOGICAL.
     Y   The type shall be either INTEGER(*) or LOGICAL.

Return value:
     The return type is either INTEGER(*) or LOGICAL after cross-promotion of the arguments.

Example:

          PROGRAM test_or
            LOGICAL :: T = .TRUE., F = ..FALSE.
            INTEGER :: a, b
            DATA a / Z'F' /, b / Z'3' /

            WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
            WRITE (*,*) OR(a, b)
          END PROGRAM

See also:
     F95 elemental function: IOR

PACK --- Pack an array into an array of rank one
================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     UNPACK

PERROR --- Print system error message
=====================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     IERRNO

PRECISION --- Decimal precision of a real kind
==============================================

Description:
     PRECISION(X) returns the decimal precision in the model of the type of X.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     I = PRECISION(X)

Arguments:

     X   shall be of type REAL or COMPLEX.

Return value:
     The return value is of type INTEGER and of the default integer kind.

Example:

          program prec_and_range
            real(kind=4) :: x(2)
            complex(kind=8) :: y

            print *, precision(x), range(x)
            print *, precision(y), range(y)
          end program prec_and_range

PRESENT --- Determine whether an optional argument is specified
===============================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:

Arguments:

Return value:

Example:

See also:

PRODUCT --- Product of array elements
=====================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     SUM

RADIX --- Base of a model number
================================

Description:
     RADIX(X) returns the base of the model representing the entity X.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     R = RADIX(X)

Arguments:

     X   Shall be of type INTEGER or REAL

Return value:
     The return value is a scalar of type INTEGER and of the default integer kind.

Example:

          program test_radix
            print *, "The radix for the default integer kind is", radix(0)
            print *, "The radix for the default real kind is", radix(0.0)
          end program test_radix

RANDOM_NUMBER --- Pseudo-random number
======================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental subroutine

Syntax:

Arguments:

Return value:

Example:

See also:
     RANDOM_SEED

RANDOM_SEED --- Initialize a pseudo-random number sequence
==========================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

See also:
     RANDOM_NUMBER

RAND --- Real pseudo-random number
==================================

Description:
     RAND(FLAG) returns a pseudo-random number from a uniform distribution between 0 and 1. If FLAG is 0, the next number in the current sequence is returned; if FLAG is 1, the generator is restarted by CALL SRAND(0); if FLAG has any other value, it is used as a new seed with SRAND.

Standard:
     GNU extension

Class:
     non-elemental function

Syntax:
     X = RAND(FLAG)

Arguments:

     FLAG   shall be a scalar INTEGER of kind 4.

Return value:
     The return value is of REAL type and the default kind.

Example:

          program test_rand
            integer,parameter :: seed = 86456

            call srand(seed)
            print *, rand(), rand(), rand(), rand()
            print *, rand(seed), rand(), rand(), rand()
          end program test_rand

Note:
     For compatibility with HP FORTRAN 77/iX, the RAN intrinsic is provided as an alias for RAND.

See also:
     SRAND, RANDOM_NUMBER

RANGE --- Decimal exponent range of a real kind
===============================================

Description:
     RANGE(X) returns the decimal exponent range in the model of the type of X.

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:
     I = RANGE(X)

Arguments:

     X   shall be of type REAL or COMPLEX.

Return value:
     The return value is of type INTEGER and of the default integer kind.

Example:
     See PRECISION for an example.

RAN --- Real pseudo-random number
=================================

Standard:
     GNU extension

See also:
     RAND, RANDOM_NUMBER

REAL --- Convert to real type
=============================

Description:
     REAL(X [, KIND]) converts its argument X to a real type.  The REALPART(X) function is provided for compatibility with g77, and its use is strongly discouraged.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:

     X = REAL(X)
     X = REAL(X, KIND)
     X = REALPART(Z)

Arguments:

     X   shall be INTEGER(*), REAL(*), or
     COMPLEX(*).
     KIND    (Optional) KIND shall be a scalar integer.

Return value:
     These functions return a REAL(*) variable or array under the following rules:

     (A)
          REAL(X) is converted to a default real type if X is an integer or real variable.

     (B)
          REAL(X) is converted to a real type with the kind type parameter of X if X is a complex variable.

     (C)
          REAL(X, KIND) is converted to a real type with kind type parameter KIND if X is a complex, integer, or real variable.

Example:

          program test_real
            complex :: x = (1.0, 2.0)
            print *, real(x), real(x,8), realpart(x)
          end program test_real

See also:
     DBLE, DFLOAT, FLOAT

RENAME --- Rename a file
========================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

See also:

REPEAT --- Repeated string concatenation
========================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:

RESHAPE --- Function to reshape an array
========================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:
     SHAPE

RRSPACING --- Reciprocal of the relative spacing
================================================

Description:
     RRSPACING(X) returns the  reciprocal of the relative spacing of model numbers near X.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     Y = RRSPACING(X)

Arguments:

     X   shall be of type REAL.

Return value:
     The return value is of the same type and kind as X. The value returned is equal to ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X).

RSHIFT --- Right shift bits
===========================

Not yet implemented in gfortran.

Description:

Standard:
     GNU extension

Class:
     Function

Syntax:

Arguments:

Return value:

Example:

See also:
     g77 features lacking in gfortran (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292)

SCALE --- Scale a real value
============================

Description:
     SCALE(X,I) returns X * RADIX(X)**I.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     Y = SCALE(X, I)

Arguments:

     X   The type of the argument shall be a REAL.
     I   The type of the argument shall be a INTEGER.

Return value:
     The return value is of the same type and kind as X. Its value is X * RADIX(X)**I.

Example:

          program test_scale
            real :: x = 178.1387e-4
            integer :: i = 5
            print *, scale(x,i), x*radix(x)**i
          end program test_scale

SCAN --- Scan a string for the presence of a set of characters
==============================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

See also:

SECNDS --- Time function
========================

Description:
     SECNDS(X) gets the time in seconds from the real-time system clock. X is a reference time, also in seconds. If this is zero, the time in seconds from midnight is returned. This function is non-standard and its use is discouraged.

Standard:
     GNU extension

Class:
     function

Syntax:
     T = SECNDS (X)

Arguments:

     Name          Type
     T       REAL(4)
     X       REAL(4)

Return value:
     None

Example:

          program test_secnds
              real(4) :: t1, t2
              print *, secnds (0.0)   ! seconds since midnight
              t1 = secnds (0.0)       ! reference time
              do i = 1, 10000000      ! do something
              end do
              t2 = secnds (t1)        ! elapsed time
              print *, "Something took ", t2, " seconds."
          end program test_secnds

SELECTED_INT_KIND --- Choose integer kind
=========================================

Description:
     SELECTED_INT_KIND(I) return the kind value of the smallest integer type that can represent all values ranging from -10^I (exclusive) to 10^I (exclusive). If there is no integer kind that accommodates this range, SELECTED_INT_KIND returns -1.

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

     J = SELECTED_INT_KIND(I)

Arguments:

     I   shall be a scalar and of type INTEGER.

Example:

          program large_integers
            integer,parameter :: k5 = selected_int_kind(5)
            integer,parameter :: k15 = selected_int_kind(15)
            integer(kind=k5) :: i5
            integer(kind=k15) :: i15

            print *, huge(i5), huge(i15)

            ! The following inequalities are always true
            print *, huge(i5) >= 10_k5**5-1
            print *, huge(i15) >= 10_k15**15-1
          end program large_integers

SELECTED_REAL_KIND --- Choose real kind
=======================================

Description:
     SELECTED_REAL_KIND(P,R) return the kind value of a real data type with decimal precision greater of at least P digits and exponent range greater at least R.

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

     I = SELECTED_REAL_KIND(P,R)

Arguments:

     P   (Optional) shall be a scalar and of type INTEGER.
     R   (Optional) shall be a scalar and of type INTEGER.

     At least one argument shall be present.

Return value:

     SELECTED_REAL_KIND returns the value of the kind type parameter of a real data type with decimal precision of at least P digits and a decimal exponent range of at least R. If more than one real data type meet the criteria, the kind of the data type with the smallest decimal precision is returned. If no real data type matches the criteria, the result is

     -1 if the processor does not support a real data type with a
          precision greater than or equal to P

     -2 if the processor does not support a real type with an exponent
          range greater than or equal to R

     -3 if neither is supported.

Example:

          program real_kinds
            integer,parameter :: p6 = selected_real_kind(6)
            integer,parameter :: p10r100 = selected_real_kind(10,100)
            integer,parameter :: r400 = selected_real_kind(r=400)
            real(kind=p6) :: x
            real(kind=p10r100) :: y
            real(kind=r400) :: z

            print *, precision(x), range(x)
            print *, precision(y), range(y)
            print *, precision(z), range(z)
          end program real_kinds

SET_EXPONENT --- Set the exponent of the model
==============================================

Description:
     SET_EXPONENT(X, I) returns the real number whose fractional part is that that of X and whose exponent part if I.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     Y = SET_EXPONENT(X, I)

Arguments:

     X   shall be of type REAL.
     I   shall be of type INTEGER.

Return value:
     The return value is of the same type and kind as X. The real number whose fractional part is that that of X and whose exponent part if I is returned; it is FRACTION(X) * RADIX(X)**I.

Example:

          program test_setexp
            real :: x = 178.1387e-4
            integer :: i = 17
            print *, set_exponent(x), fraction(x) * radix(x)**i
          end program test_setexp

SHAPE --- Determine the shape of an array
=========================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:

Arguments:

Return value:

Example:

See also:
     RESHAPE

SIGN --- Sign copying function
==============================

Description:
     SIGN(A,B) returns the value of A with the sign of B.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = SIGN(A,B)

Arguments:

     A   shall be a scalar of type INTEGER or REAL
     B   shall be a scalar of the same type and kind as A

Return value:
     The kind of the return value is that of A and B. If B\ge 0 then the result is ABS(A), else it is -ABS(A).

Example:

          program test_sign
            print *, sign(-12,1)
            print *, sign(-12,0)
            print *, sign(-12,-1)

            print *, sign(-12.,1.)
            print *, sign(-12.,0.)
            print *, sign(-12.,-1.)
          end program test_sign

Specific names:

     Name                Arguments        Return type      Standard
     ISIGN(A,P)   INTEGER(4)   INTEGER(4)   f95, gnu
     DSIGN(A,P)   REAL(8)   REAL(8)   f95, gnu

SIGNAL --- Signal handling subroutine (or function)
===================================================

Description:
     SIGNAL(NUMBER, HANDLER [, STATUS]) causes external subroutine HANDLER to be executed with a single integer argument when signal NUMBER occurs.  If HANDLER is an integer, it can be used to turn off handling of signal NUMBER or revert to its default action.  See signal(2).

     If SIGNAL is called as a subroutine and the STATUS argument is supplied, it is set to the value returned by signal(2).

Standard:
     GNU extension

Class:
     subroutine, non-elemental function

Syntax:

     CALL ALARM(NUMBER, HANDLER)
     CALL ALARM(NUMBER, HANDLER, STATUS)
     STATUS = ALARM(NUMBER, HANDLER)

Arguments:

     NUMBER   shall be a scalar integer, with INTENT(IN)
     HANDLER  Signal handler (INTEGER FUNCTION or
     SUBROUTINE) or dummy/global INTEGER scalar.
     INTEGER. It is INTENT(IN).
     STATUS   (Optional) STATUS shall be a scalar
     integer. It has INTENT(OUT).

Return value:
     The SIGNAL functions returns the value returned by signal(2).

Example:

          program test_signal
            intrinsic signal
            external handler_print

            call signal (12, handler_print)
            call signal (10, 1)

            call sleep (30)
          end program test_signal

SIN --- Sine function
=====================

Description:
     SIN(X) computes the sine of X.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = SIN(X)

Arguments:

     X   The type shall be REAL(*) or
     COMPLEX(*).

Return value:
     The return value has same type and kind as X.

Example:

          program test_sin
            real :: x = 0.0
            x = sin(x)
          end program test_sin

Specific names:

     Name              Argument            Return type         Standard
     DSIN(X)    REAL(8) X    REAL(8)      f95, gnu
     CSIN(X)    COMPLEX(4) X    COMPLEX(4)      f95, gnu
     ZSIN(X)    COMPLEX(8) X    COMPLEX(8)      f95, gnu
     CDSIN(X)   COMPLEX(8) X    COMPLEX(8)      f95, gnu

See also:
     ASIN

SINH --- Hyperbolic sine function
=================================

Description:
     SINH(X) computes the hyperbolic sine of X.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     X = SINH(X)

Arguments:

     X   The type shall be REAL(*).

Return value:
     The return value is of type REAL(*).

Example:

          program test_sinh
            real(8) :: x = - 1.0_8
            x = sinh(x)
          end program test_sinh

Specific names:

     Name              Argument            Return type         Standard
     DSINH(X)   REAL(8) X    REAL(8)      F95 and later

See also:
     ASINH

SIZE --- Determine the size of an array
=======================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:

Arguments:

Return value:

Example:

See also:

SNGL --- Convert double precision real to default real
======================================================

Description:
     SNGL(A) converts the double precision real A to a default real value. This is an archaic form of REAL that is specific to one type for A.

Standard:
     GNU extension

Class:
     function

Syntax:
     X = SNGL(A)

Arguments:

     A   The type shall be a double precision REAL.

Return value:
     The return value is of type default REAL.

See also:
     DBLE

SPACING --- Smallest distance between two numbers of a given type
=================================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

See also:

SPREAD --- Add a dimension to an array
======================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:

SQRT --- Square-root function
=============================

Description:
     SQRT(X) computes the square root of X.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = SQRT(X)

Arguments:

     X   The type shall be REAL(*) or
     COMPLEX(*).

Return value:
     The return value is of type REAL(*) or COMPLEX(*). The kind type parameter is the same as X.

Example:

          program test_sqrt
            real(8) :: x = 2.0_8
            complex :: z = (1.0, 2.0)
            x = sqrt(x)
            z = sqrt(z)
          end program test_sqrt

Specific names:

     Name               Argument               Return type            Standard
     DSQRT(X)    REAL(8) X       REAL(8)         F95 and later
     CSQRT(X)    COMPLEX(4) X    COMPLEX(4)      F95 and later
     ZSQRT(X)    COMPLEX(8) X    COMPLEX(8)      GNU extension
     CDSQRT(X)   COMPLEX(8) X    COMPLEX(8)      GNU extension

SRAND --- Reinitialize the random number generator
==================================================

Description:
     SRAND reinitializes the pseudo-random number generator called by RAND and IRAND. The new seed used by the generator is specified by the required argument SEED.

Standard:
     GNU extension

Class:
     non-elemental subroutine

Syntax:
     CALL SRAND(SEED)

Arguments:

     SEED   shall be a scalar INTEGER(kind=4).

Return value:
     Does not return.

Example:
     See RAND and IRAND for examples.

Notes:
     The Fortran 2003 standard specifies the intrinsic RANDOM_SEED to initialize the pseudo-random numbers generator and RANDOM_NUMBER to generate pseudo-random numbers. Please note that in gfortran, these two sets of intrinsics (RAND, IRAND and SRAND on the one hand, RANDOM_NUMBER and RANDOM_SEED on the other hand) access two independent pseudo-random number generators.

See also:
     RAND, RANDOM_SEED, RANDOM_NUMBER

STAT --- Get file status
========================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:

Syntax:

Arguments:

Return value:

Example:

See also:
     FSTAT

SUM --- Sum of array elements
=============================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:
     PRODUCT

SYMLNK --- Create a symbolic link
=================================

Intrinsic implemented, documentation pending.

Description:

Standard:

Class:
     GNU extension

Syntax:

Arguments:

Return value:

Example:

See also:

SYSTEM --- Execute a shell command
==================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

See also:

SYSTEM_CLOCK --- Time function
==============================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

See also:

TAN --- Tangent function
========================

Description:
     TAN(X) computes the tangent of X.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = TAN(X)

Arguments:

     X   The type shall be REAL(*).

Return value:
     The return value is of type REAL(*).  The kind type parameter is the same as X.

Example:

          program test_tan
            real(8) :: x = 0.165_8
            x = tan(x)
          end program test_tan

Specific names:

     Name              Argument            Return type         Standard
     DTAN(X)    REAL(8) X    REAL(8)      F95 and later

See also:
     ATAN

TANH --- Hyperbolic tangent function
====================================

Description:
     TANH(X) computes the hyperbolic tangent of X.

Standard:
     F77 and later

Class:
     Elemental function

Syntax:
     X = TANH(X)

Arguments:

     X   The type shall be REAL(*).

Return value:
     The return value is of type REAL(*) and lies in the range - 1 \leq tanh(x) \leq 1 .

Example:

          program test_tanh
            real(8) :: x = 2.1_8
            x = tanh(x)
          end program test_tanh

Specific names:

     Name              Argument            Return type         Standard
     DTANH(X)   REAL(8) X    REAL(8)      F95 and later

See also:
     ATANH

TIME --- Time function
======================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:
     Non-elemental function

Syntax:

Arguments:

Return value:

Example:

See also:

TINY --- Smallest positive number of a real kind
================================================

Description:
     TINY(X) returns the smallest positive (non zero) number in the model of the type of X.

Standard:
     F95 and later

Class:
     Elemental function

Syntax:
     Y = TINY(X)

Arguments:

     X   shall be of type REAL.

Return value:
     The return value is of the same type and kind as X

Example:
     See HUGE for an example.

TRANSFER --- Transfer bit patterns
==================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:

TRANSPOSE --- Transpose an array of rank two
============================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:

TRIM --- Function to remove trailing blank characters of a string
=================================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:

UBOUND --- Upper dimension bounds of an array
=============================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Inquiry function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:
     LBOUND

UMASK --- Set the file creation mask
====================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

UNLINK --- Remove a file from the file system
=============================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     GNU extension

Class:
     Subroutine

Syntax:

Arguments:

Return value:

Example:

See also:
     LINK

UNMASK --- (?)
==============

Intrinsic implemented, documentation pending.

Description:

Standard:

Class:

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

UNPACK --- Unpack an array of rank one into an array
====================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Transformational function

Syntax:

Arguments:

Return value:

Example:

See also:
     PACK

VERIFY --- Scan a string for the absence of a set of characters
===============================================================

Intrinsic implemented, documentation pending.

Description:

Standard:
     F95 and later

Class:
     Elemental function

Syntax:

Arguments:

Return value:

Example:

Specific names:

See also:

XOR --- Bitwise logical exclusive OR
====================================

Description:
     Bitwise logical exclusive or.

     This intrinsic routine is provided for backwards compatibility with GNU Fortran 77.  For integer arguments, programmers should consider the use of the IEOR intrinsic defined by the Fortran standard.

Standard:
     GNU extension

Class:
     Non-elemental function

Syntax:
     RESULT = XOR(X, Y)

Arguments:

     X   The type shall be either INTEGER(*) or LOGICAL.
     Y   The type shall be either INTEGER(*) or LOGICAL.

Return value:
     The return type is either INTEGER(*) or LOGICAL after cross-promotion of the arguments.

Example:

          PROGRAM test_xor
            LOGICAL :: T = .TRUE., F = .FALSE.
            INTEGER :: a, b
            DATA a / Z,'F' /, b / Z'3' /

            WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
            WRITE (*,*) XOR(a, b)
          END PROGRAM

See also:
     F95 elemental function: IEOR