Supported Native and Nonnative Numeric Formats

Visual Fortran supports the following little endian floating-point formats in memory:

Floating-Point Size Format in Memory
REAL(KIND=4), COMPLEX(KIND=4) IEEE S_floating
REAL(KIND=8), COMPLEX(KIND=8) IEEE T_floating

If your program needs to read or write unformatted data files containing a floating-point format that differs from the format in memory for that data size, you can request that the unformatted data be converted.

Data storage in different computers uses a convention of either little endian or big endian storage. The storage convention generally applies to numeric values that span multiple bytes, as follows:

The following figure shows the difference between the two byte-ordering schemes.

Little and Big Endian Storage of an INTEGER Value

Moving unformatted data files between big endian and little endian computers requires that the data be converted.

Visual Fortran provides the capability for programs to read and write unformatted data (originally written using unformatted I/O statements) in several nonnative floating-point formats and in big endian INTEGER or floating-point format. Supported nonnative floating-point formats include Compaq VAX little endian floating-point formats supported by VAX FORTRAN, standard IEEE big endian floating-point format found on most Sun MicrosystemsTM systems and IBM RISC System/6000 systems, IBM floating-point formats (associated with the IBM's System/370 and similar systems), and CRAY floating-point formats.

Converting unformatted data instead of formatted data is generally faster and is less likely to lose precision of floating-point numbers.

The native memory format includes little endian integers and little endian IEEE floating-point formats, S_float for REAL(KIND=4) and COMPLEX(KIND=4) declarations and T_float for REAL(KIND=8) and COMPLEX(KIND=8) declarations.

The keywords for supported nonnative unformatted file formats and their data types are listed in the following table:

Nonnative Numeric Formats, Keywords, and Supported Data Types

Keyword Description
BIG_ENDIAN Big endian integer data of the appropriate size (one, two, or four bytes) and big endian IEEE floating-point (REAL(KIND=4), REAL(KIND=8), COMPLEX(KIND=4), COMPLEX(KIND=8)) formats of the appropriate size for either real or complex numbers. INTEGER(KIND=1) data is the same for little endian and big endian.
CRAY Big endian integer data of the appropriate size (one, two, four, or eight bytes) and big endian CRAY proprietary floating-point format of size REAL(KIND=8) or COMPLEX(KIND=8).
FDX Little endian integer data of the appropriate size (one, two, four, or eight bytes) and Compaq VAX floating-point data of format F_floating for REAL(KIND=4) or COMPLEX(KIND=4), and D_Floating for REAL(KIND=8) or COMPLEX(KIND=8).
FGX Little endian integer data of the appropriate size (one, two, four, or eight bytes) and Compaq VAX floating-point data of format F_floating for REAL(KIND=4) or COMPLEX(KIND=4), and G_Floating for REAL(KIND=8) or COMPLEX(KIND=8).
IBM Big endian integer data of the appropriate size (one, two, or four bytes) and big endian IBM proprietary floating-point format of size REAL(KIND=4) or COMPLEX(KIND=4) or size REAL(KIND=8) or COMPLEX(KIND=8).
LITTLE_ENDIAN Native little endian integers of the appropriate size (one, two, four, or eight bytes) and native little endian IEEE floating-point data of the appropriate size and type (REAL(KIND=4), REAL(KIND=8), COMPLEX(KIND=4), COMPLEX(KIND=8)). These are the same formats as stored in memory. For additional information on supported ranges for these data types, see Native IEEE Floating-Point Representations.
NATIVE No conversion occurs between memory and disk. This is the default for unformatted files.
VAXD Little endian integers of the appropriate size (one, two, four, or eight bytes) and Compaq VAX floating-point format F_floating for size REAL(KIND=4) or COMPLEX(KIND=4), and D_floating for size REAL(KIND=8) or COMPLEX(KIND=8).
VAXG Little endian integers of the appropriate size (one, two, four, or eight bytes) and Compaq VAX floating-point format F_floating for size REAL(KIND=4) or COMPLEX(KIND=4), and G_floating for size REAL(KIND=8) or COMPLEX(KIND=8).

When reading a nonnative format, the nonnative format on disk is converted to native format in memory. If a converted nonnative value is outside the range of the native data type, a run-time message is displayed.