LF Fortran 95

TRANSFER Function

Description

The TRANSFER function interprets the physical representation of a number with the type and type parameters of a given number.

Syntax

TRANSFER (source, mold [, size] )

Required Arguments

source is an INTENT(IN) scalar or array of any type.

mold is an INTENT(IN) scalar or array of any type.

Optional Arguments

size is an INTENT(IN) scalar of type INTEGER. The corresponding actual argument must not be a optional dummy argument.

Result

The result is of the same type and type parameters as mold.

If mold is scalar and size is absent the result is a scalar.

If mold is an array and size is absent, the result is an array of rank one. Its size is as small as possible such that it is not shorter than source.

If size is present, the result is an array of rank one and of size size.

If the physical representation of the result is the same length as the physical representation of source, the physical representation of the result is that of source.

If the physical representation of the result is longer than that of source, the physical representation of the leading part of the result is that of source and the trailing part is undefined.

If the physical representation of the result is shorter than that of source, the physical representation of the result is the leading part of source.

Example

character(len=4) :: c="LOVE" integer :: i,j(2,2) real :: r logical :: l write(*,*) transfer(c,i) ! writes 1163284300 write(*,*) transfer(c,r) ! writes 3428.95605 write(*,*) transfer(c,l) ! writes T