Compaq Fortran
User Manual for
Tru64 UNIX and Linux Alpha Systems


Previous Contents Index

A.4 Compatibility with Compaq Fortran 77 and Compaq Fortran for OpenVMS Systems

This section provides compatibility information for those who:

If your primary concern is the design and development of Compaq Fortran applications for only Compaq Tru64 UNIX (or other U*X) systems, consider skipping this section.

This section discusses the following topics:

A.4.1 Language Features Specific to Compaq Fortran 77 and Compaq Fortran for OpenVMS Systems

Some extensions to the FORTRAN-77 standard provided by Compaq Fortran 77 and Compaq Fortran for OpenVMS Systems are specific to the OpenVMS operating system, VAX architecture, or certain products on OpenVMS systems. Such extensions are not included in Compaq Fortran 77 or Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha Systems.

For information on language compatibility between Compaq Fortran and Compaq Fortran 77 without regard to operating system or architecture differences, see Section A.2.

Compaq Fortran 77 and Compaq Fortran products for OpenVMS systems include:

Unless otherwise noted, the following list describes the Compaq Fortran 77 extensions in Compaq Fortran 77 and/or Compaq Fortran for OpenVMS systems that are not supported by Compaq Fortran Version 5.3 for Compaq Tru64 UNIX Systems:

The following language and VAX architecture features are associated only with Compaq Fortran 77 on OpenVMS VAX Systems (previously called VAX FORTRAN) and are not supported by Compaq Fortran Version 5.3 for Compaq Tru64 UNIX and Compaq Fortran Version 1.0 for Linux Alpha systems:

The following language and VAX architecture features are interpretation differences between Compaq Fortran and Compaq Fortran 77 on Alpha systems and Compaq Fortran 77 on OpenVMS VAX Systems (previously called VAX FORTRAN):

For More Information:

A.4.2 OpenVMS Data Porting Considerations

When porting data between systems running the Compaq Tru64 UNIX and Linux Alpha operating systems and systems running the OpenVMS operating system, the file formats and the floating-point representations may differ.

The file and record formats of Compaq Fortran 77 on Compaq Tru64 UNIX systems are compatible with Compaq Fortran on Compaq Tru64 UNIX and Linux Alpha systems; they share the same language run-time I/O environment (see Chapter 7).

OpenVMS Fortran1 files containing only character, integer, or logical data do not need field-by-field conversion, but the record types must match. The segmented record type is the same on OpenVMS Fortran systems and Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha systems. Certain other record types, such as variable-length records, differ between OpenVMS systems and Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha systems.

Table A-2 summarizes the OpenVMS Fortran record types and their equivalent record types in Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha systems.

Table A-2 Equivalent Record Types for OpenVMS Fortran and Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha Systems
OpenVMS Fortran Record Type Compaq Tru64 UNIX Fortran Record Type Comments
Fixed-length None Equivalent (must be copied correctly) if you use sequential access and you specify the -vms option when compiling the Compaq Fortran file. Otherwise, convert the file to a different record type.
Variable-length None Not equivalent. Convert the file to a different record type.
Segmented Segmented Equivalent (must be copied correctly). Segmented data files can contain formatted or unformatted data.
Stream None Not equivalent. Convert the file to a different record type.
Stream_CR Stream_CR Equivalent (must be copied correctly).
Stream_LF Stream_LF Equivalent (must be copied correctly).

A.4.2.1 Matching Record Types

To match record types, there are several options:

A.4.2.2 Copying Files

Equivalent record types must be copied carefully to preserve control information and record characteristics. For example:

To transfer (copy) the files, choose one of the following methods:

In addition to using the correct record type and carefully transferring the files, the data inside unformatted records may need to be converted. OpenVMS Fortran data files that contain VAX binary floating-point data must be converted before they can be accessed by a Compaq Fortran program. There are several methods:

If you need to convert unformatted floating-point data, keep in mind that Compaq Fortran 77 for OpenVMS VAX programs (VAX hardware) store the following:

In contrast, Compaq Fortran programs running on the Compaq Tru64 UNIX or Linux Alpha operating system on Alpha hardware store the following:

Compaq Fortran 77 and Compaq Fortran for OpenVMS Alpha programs store floating-point data in the format specified by the /FLOAT qualifier:

For information on Compaq Fortran data types, see Chapter 9.

For More Information:

A.4.3 Nonnative VAX Floating-Point Representations

This section provides information about VAX floating-point data formats. You can convert unformatted files from OpenVMS systems by using the methods described in Chapter 10.

On OpenVMS VAX systems, single-precision data (such as REAL*4) is stored in VAX F_float format and double-precision data (such as REAL*8) data can be stored in either VAX D_float or VAX G_float formats, depending on whether the /G_FLOATING qualifier was specified on the FORTRAN command line (see the DEC Fortran User Manual for OpenVMS VAX Systems).

On OpenVMS Alpha systems, you can specify the floating-point format in memory by using the /FLOAT qualifier (see the DEC Fortran User Manual for OpenVMS AXP Systems). Single-precision data on OpenVMS Alpha systems is stored in either VAX F_float or IEEE S_float formats; double-precision data can be stored in VAX D_float, VAX G_float, or IEEE T_float formats.

REAL*16 (extended precision) data is always stored in IEEE style X_float format on Alpha systems.

With VAX floating-point data types, the binary radix point is to the left of the most-significant bit.

A.4.3.1 VAX F_float REAL (KIND=4) or REAL*4

Intrinsic REAL (KIND=4) or REAL*4 F_float data occupies four contiguous bytes. Bits are labeled from the right, 0 through 31, as shown in Figure A-1.

Figure A-1 VAX F_float REAL (KIND =4) or REAL*4 Representation


The form of REAL (KIND=4) or REAL*4 F_float data is sign magnitude, where:

When converting unformatted F_float data from an OpenVMS system, the approximate range is 0.293873588E--38 to 1.7014117E38. The precision is approximately one part in 2**23, typically seven decimal digits.

A.4.3.2 VAX G_float REAL (KIND=8) or REAL*8

Intrinsic REAL (KIND=8) or REAL*8 (same as DOUBLE PRECISION) G_float data occupies eight contiguous bytes. The bits are labeled from the right, 0 through 63, as shown in Figure A-2.

Figure A-2 VAX G_float REAL (KIND =8) or REAL*8 Representation


The form of REAL (KIND=8) or REAL*8 G_float data is sign magnitude, where:

When converting unformatted G_float data from an OpenVMS system, the approximate range is 0.5562684646268004D--308 to 0.89884656743115785407D308. The precision of G_float data is approximately one part in 2**52, typically 15 decimal digits.

A.4.3.3 VAX D_float REAL (KIND=8) or REAL*8

Intrinsic REAL (KIND=8) or REAL*8 (same as DOUBLE PRECISION) D_float data occupies eight contiguous bytes. Bits are labeled from the right, 0 through 63, as shown in Figure A-3.

Figure A-3 VAX D_float REAL (KIND =8) or REAL*8 Representation


The form of REAL (KIND=8) or REAL*8 D_float data is identical to an F_float real number, except for an additional 32 low-significance fraction bits. The exponent conventions and approximate range of values are the similar to those for F_float.

When converting unformatted D_float data from an OpenVMS system, the approximate range is 0.2938735877055719D--38 to 1.70141183460469229D38. The precision is approximately one part in 2**55, typically 16 decimal digits.

A.4.3.4 VAX F_float COMPLEX (KIND=4) or COMPLEX*8

Intrinsic COMPLEX (KIND=4) or COMPLEX*8 (single-precision COMPLEX) data in VAX F_float format occupies eight contiguous bytes containing a pair of REAL*4 values. The low-order four bytes contain REAL*4 data that represents the real part of the complex number. The high-order four bytes contain REAL (KIND=4) or REAL*4 data that represents the imaginary part of the complex number. Figure A-4 shows a COMPLEX*8 number in F_float format.

Figure A-4 VAX F_float COMPLEX (KIND =4) or COMPLEX*8 Representation


The limits for REAL (KIND=4) or REAL*4 apply to the two separate real and imaginary parts of a COMPLEX (KIND=4) or COMPLEX*8 number. Like REAL (KIND=4) or REAL*4 numbers, the sign bit representation is 0 (zero) for positive numbers and 1 for negative numbers.

A.4.3.5 VAX G_float and D_float COMPLEX (KIND=8) or COMPLEX*16

Intrinsic COMPLEX (KIND=8) or COMPLEX*16 (same as DOUBLE COMPLEX) data occupies 16 contiguous bytes containing a pair of REAL*8 or REAL (KIND=8) values. COMPLEX (KIND=8) or COMPLEX*16 data from an OpenVMS system is in one of the following REAL*8 or REAL (KIND=8) formats:

The low-order eight bytes contain REAL (KIND=8) or REAL*8 data that represents the real part of the complex data. The high-order eight bytes contain REAL (KIND=8) or REAL*8 data that represents the imaginary part of the complex data, as shown in Figure A-5 (for G_float) and Figure A-6 (for D_float).

Figure A-5 VAX G_float COMPLEX (KIND =8) or COMPLEX*16 Representation


Figure A-6 VAX D_float COMPLEX (KIND =8) or COMPLEX*16 Representation


The limits for REAL (KIND=8) or REAL*8 apply to the two separate real and imaginary parts of a COMPLEX (KIND=8) or COMPLEX*16 number. Like REAL (KIND=8) or REAL*8 numbers, the sign bit representation is 0 (zero) for positive numbers and 1 for negative numbers.

A.4.3.6 VAX H_float Representation

The REAL (KIND=16) or REAL*16 VAX H_float data format is used only on OpenVMS VAX systems. On Alpha systems, REAL (KIND=16) extended precision data is always stored in Alpha X_float format.

With VAX floating-point data types, the binary radix point is to the left of the most-significant bit.

As shown in Figure A-7, REAL*16 H_float data is 16 contiguous bytes starting on an arbitrary byte boundary. The bits are labeled from the right, 0 through 127.

Figure A-7 VAX H_float REAL*16 Representation (VAX Systems)


The form of an H_float REAL*16 data is sign magnitude with bit 15 the sign bit, bits 14:0 an excess 16384 binary exponent, and bits 127:16 a normalized 113-bit fraction with the redundant most significant fraction bit not represented.

The value of H_float data is in the approximate range 0.84*10**--4932 through 0.59*10**4932. The precision of H_float data is approximately one part in 2**112 or typically 33 decimal digits.

For More Information:

Note

1 OpenVMS Fortran refers collectively to VAX FORTRAN, Compaq Fortran 77 for OpenVMS Alpha Systems, and Compaq Fortran 77 for OpenVMS VAX Systems


Previous Next Contents Index