HP OpenVMS Systems

ask the wizard
Content starts here

Floating point conversions?

» close window

The Question is:

In migrating a system coded in Fotran from VAX (7.1) to Alpha (7.1), a data
 record was define with Real*16 fields (H-float). I know there is no H-float
 support on Alpha, but is there a way to compile the Fortran sources to
 correctly interpret those fields
 on the Alpha ? some documentation I saw led me to believe that using the
 qualifier /CONVERT=VAXD may help; it did not. When I attempt to access the
 value in the data record with the debugger I get following:
READ_REAL\TEST.VALUE:   Illegal floating point number
Thanks for your help.
David F.

The Answer is :

Fortran's /CONVERT= options apply to I/O transfers of
atomic datatypes and arrays of them (for example, an
array of H_floats could be converted automatically),
but do not apply to transfers of records declared with
the STRUCTURE and RECORD statements.  Perhaps that's
why you found it ineffective in your case?  Similarly,
if you use EQUIVALENCE in such a way that the I/O statement
names variables whose type doesn't match the data, the
conversion operations can't work automatically.
By the way, you can get finer control over which files
have datatype conversion applied, either by using a
CONVERT= keyword on the OPEN statement, or by defining
logical names to select which unit numbers or filetypes
need conversion. See the Fortran User's Guide for details.
If you need to apply conversion to data in a record
declared with STRUCTURE and RECORD statements, or to data
transferred with the wrong datatype through EQUIVALENCE,
you should call a conversion routine such as
CVT$CONVERT_FLOAT.  Specify that the file data is
H_float, and the native data is X_float.  On Alpha, a
REAL*16 declaration selects the X_float datatype, which
is an IEEE extended datatype with 15 exponent bits and
113 fraction bits (including a hidden bit).

answer written or last revised on ( 21-JUL-2000 )

» close window