A small number of Fortran intrinsic functions have an optional final argument which specifies the kind of the result. Thus, for example, if n is an integer, REAL(n,4) returns a real value of kind 4, which is usually a 4-byte real. The expression REAL(n,8) returns a real of kind 8, usually an 8-byte real.
The author has not found a reliable way to implement a user-written function which returns a value where the kind depends on the function arguments. The engineering tool is therefore used to replace these function invocations, either using the obsolescent intrinsics DBLE and SNGL or by a two stage process. For example, where r8 is an emulated 8-byte real variable, and i8 is an 8-byte integer variable, the code:
r8 = REAL(i8,8)
is replaced by
r8 = DBLE(i8)
The code:
i8 = INT(r8,8)
is replaced by
i8 = INT(r8%value,8)