# Entry Points in Function Subprograms

If the ENTRY statement is contained in a function subprogram, it defines an additional function. The name of the function is the name specified in the ENTRY statement, and its result variable is the entry name or the name specified by RESULT (if any).

If the entry result variable has the same characteristics as the FUNCTION statement's result variable, their result variables identify the same variable, even if they have different names. Otherwise, the result variables are storage associated and must all be nonpointer scalars of intrinsic type, in one of the following groups:

Group 1 | Type default integer, default real, double precision real, default complex, double complex, or default logical
Group 2 | Type REAL(16) and COMPLEX(16)
Group 3 | Type default character (with identical lengths)

All entry names within a function subprogram are associated with the name of the function subprogram. Therefore, defining any entry name or the name of the function subprogram defines all the associated names with the same data type. All associated names with different data types become undefined.

If RECURSIVE is specified in the FUNCTION statement, all entry points in the FUNCTION are recursive. The interface of the function defined by the ENTRY statement is explicit within the function subprogram.

## Examples

The following example shows a function subprogram that computes the hyperbolic functions SINH, COSH, and TANH:

    REAL FUNCTION TANH(X)
      TSINH(Y) = EXP(Y) - EXP(-Y)
      TCOSH(Y) = EXP(Y) + EXP(-Y)

      TANH = TSINH(X)/TCOSH(X)
      RETURN

      ENTRY SINH(X)
      SINH = TSINH(X)/2.0
      RETURN

      ENTRY COSH(X)
      COSH = TCOSH(X)/2.0
      RETURN
    END

Parent topic: Entry Points in Subprograms

## See Also

RESULT keyword