Operating System - OpenVMS
1752667 Members
5471 Online
108788 Solutions
New Discussion

Alpha to Integrity application porting - issue

 
SOLVED
Go to solution
Jenwae
Advisor

Re: Alpha to Integrity application porting - issue

Hi All,

 

Thank you so much for the wealth of information.

I have read them through all, and implemented a few suggestions as per your advice.

The correct prototyping has helped to resolve the float issue when float type (not double) arguments are passed

 

We have decided to do a database conversion, changing all g_float values to ieee float values.

 

One question I have left is, do I need to convert data of type float?

Eg,

float timer;

We seem to encounter problems reading float values (because we are only converting double variables).

We have converted our data files with double variables to ieee values, but did not convert the float variables.

The float variables read in from the legacy data files (which are in g_float) showed 0, or ome incorrect values.

 

Question is, is it necessary to convert float variables? If so, does the CVT$ calls support converting float values?

 

Thank you,

James

 

John Gillings
Honored Contributor

Re: Alpha to Integrity application porting - issue

James,

 

   I'd recommend converting everything to use IEEE types. Put the work in now, rather than spend time later trying to track down obscure bugs due to mismatches.

 

   Regarding your "float timer", maybe you're using the RTL routine LIB$WAIT? It takes a floating point value in seconds. The default floating point is F_FLOAT for compatibility with the original VAX version. There's a new, optional 3rd argument to specify the floating point type. If you're finding that delay times using LIB$WAIT are incorrect, check the data types, and add a float-type argument to match.

 

See

 

$ HELP RTL LIB$ LIB$WAIT arguments

 

CVT$CONVERT_FLOAT can convert any floating point type to any other (including up and down precision, and even some non-OpenVMS types). You just specify the data type using the type code arguments for input and output

 

 

                                                                 Size in
           input_type_code          Format                       Bytes

           CVT$K_VAX_F              F_Floating                   4
           CVT$K_VAX_D              D_Floating                   8
           CVT$K_VAX_G              G_Floating                   8

           CVT$K_VAX_H              H_Floating                   16
           CVT$K_IEEE_S             IEEE_S_Floating              4
           CVT$K_IEEE_T             IEEE_T_Floating              8
           CVT$K_IEEE_X             IEEE_X_Floating              16
           CVT$K_IBM_LONG           IBM_Long_Floating            8
           CVT$K_IBM_SHORT          IBM_Short_Floating           4
           CVT$K_CRAY               CRAY_Floating                8

 

           Declarations for the input_type_code argument are in the $CVTDEF
           module found in the system symbol libraries.

 

A crucible of informative mistakes
jreagan
Advisor

Re: Alpha to Integrity application porting - issue

You want to convert both double and single precision in your data files.  Doing just the doubles will get you IEEE T for doubles, but VAX F for floats.  There is no qualifier on the compilers that allows that combination.

 

Yes, for your C application, you'll want to call CVT$CONVERT_FLOAT (it is documented in the LIB$ manual).

 

If you have all your data files, you can convert/update them (don't forget to make a backup first) or you could decide to convert on the fly when you read in the data.

 

Depending on the layout of your data and if you have the Fortran compiler, you could write a conversion program in Fortran.  It has some support for doing automatic data conversion when reading/writing binary datafiles.