VAX FLOATING POINT TO HOST FLOATING POINT CONVERSION GUIDE

(WITH PARTICULAR APPLICATION TO AIRSAR SYNOPTIC DATA)

Marcos Alves

Bruce Chapman

Eugene Chu

JPL D-11883

Revision 1.0

June 1994

National Aeronautics and Space Administration

Jet Propulsion Laboratory

California Institute of Technology

Pasadena, California

Copyright (c)1994, California Institute of Technology. U. S. Government Sponsorship under NASA Contract NAS7-918 is acknowledged.

This software is provided to you 'as is' and without warranty of any kind, expressed or implied, including but not limited to, warranties of performance, merchantability, or fitness for a particular purpose. User bears all risk as to the quality and performance of the software.

Table of Contents

1. Introduction

The user may want to transport unformatted floating point (4 bytes per sample) data files written by a VAX computer to a unix host computer. This host computer, if it is not a VAX, may have a different convention for interpreting unformatted floating point data values. The purpose of this software is to convert these non-ASCII files to the unformatted floating point representation of the host machine. This is done by reading the bytes bit by bit, converting them to floating point numbers, and then writing the results to another file.

The motivation behind writing this program was our observation and personal experience that while many users are switching from VAX computers to unix computers such as SUN,

SGI, and DEC alpha computers, there are many data files created by VAX computers that must now be used on other machines. For instance, NASA/JPL AIRSAR synthetic aperture radar synoptic data is processed on a VAX computer, but we wish to analyze the data on a DEC alpha, SUN, HP, SGI, etc., computer. This requires that the data be converted to the floating point format of several different types of computers.

This software was written with generality in mind. The data file is allowed to have any length header at the beginning of the file (header values not converted, so if it is an ASCII header it will be preserved), and any length header bytes at the beginning of each line (must be a constant length for each line).

In particular, this software was written to convert AIRSAR synoptic data from VAX floating point format to host computer floating point format. These files have three lines of ASCII header information (15360 bytes), followed by 5088 lines of data, each data line being 5120 bytes (1280 floating point numbers), with no prefix header at the beginning of each line. Therefore, these values are the default values. However, any unformatted floating point data file may be converted by this software.

This software was written in ANSI C, and should work on any computer with an ANSI C compiler. It has only been tested on unix platforms.

2. Software description, and an example

The program vaxfc converts the data by examining the 4 bytes that make up each floating point value. Refer to [2] for a complete description of VAX floating point representation. These four bytes are structured as follows, with the bits numbered as indicated:

	15	 14    13    12    11    10    9    8         7      6      5      4      3      2      1     0
	31	30    29    28    27    26    25   24       23    22    21    20    19    18    17 16    

corresponding to the byte order :

				byte 1	    byte 0                    
				byte 3	    byte 2                    

Bit 15 : sign bit.

Bits 14 through 7 : excess 128 binary exponent (binary 1 to 255 indicates true values -127 to 128)

Bits 6 though 0 and 31 through 16 : normalized 24 bit fraction with redundant most significant fraction bit not represented. Significance increases from 16 to 31 then 0 to 6.

The program is compiled as follows:

> cc vaxfc.c -o vaxfc -lm

This should create the vaxfc executable.

To find out inputs required:

> vaxfc

*********************************************************

* Welcome to vaxfc

*

* Copyright (c) 1994, California Institute of

* Technology. U.S Government Sponsorship under

* NASA Contract NAS7-918 is acknowledged.

* This software is provided to you as is and

* without warranty of any kind, expressed or

* implied, including but not limited to,

* warranties of performance, merchantability, or

* fitness for a particular purpose. User bears

* all risk as to the quality and performance of the

* software.

*

* This program reads an input file created on a VAX

* containing unformatted floating point numbers and

* writes it to an output file in the local machine

* format.

*

***************************************** ****************

vaxfc: VAX FLOAT FILE CONVERSION PROGRAM

This program reads an input file created on a VAX

containing unformatted floating point numbers and

writes it to an output file in the local machine

format.

USAGE: vaxfc infnm otfnm [-d inx iny] [-h fskip lskip]

infnm -> input file name

otfnm -> output file name

-d -> byte dimensions of input file

inx = # floating point elements per line of data

iny = # lines of data

(default x=1280, y=5088)

-h -> header bytes (usually ASCII)

fskip = # bytes leading file

lskip = # bytes leading each line

(default fskip=15360, lskip=0)

Not enough arguments for vaxfc

... execution terminated!

For example, an AIRSAR synoptic file will be converted below. This file was copied off of a data tape written by a VAX computer onto a non-VAX unix computer and named sy4168.lhh. The command line consists of the input file name (sy4168.lhh), the output file name (sy4168.lhh.conv), the number of floating point numbers per line (1280), the number of lines (5088), the number of header bytes at the beginning of the file (15360), and the number of prefix header bytes per line (0) (these are also the default values).

> vaxfc sy4168.lhh sy4168lhh.conv -d 1280 5088 -h 15360 0

**************************************************** *****

* Welcome to vaxfc

*

* Copyright (c) 1994, California Institute of

* Technology. U.S Government Sponsorship under

* NASA Contract NAS7-918 is acknowledged.

* This software is provided to you as is and

* without warranty of any kind, expressed or

* implied, including but not limited to,

* warranties of performance, merchantability, or

* fitness for a particular purpose. User bears

* all risk as to the quality and performance of the

* software.

*

* This program reads an input file created on a VAX

* containing unformatted floating point numbers and

* writes it to an output file in the local machine

* format.

*

***************************************** ****************

*vaxfc selections*

infnm: sy4168.lhh

otfnm: sy4168.lhh.conv

inx = 1280 floating point numbers per line

iny = 5088 lines

fskip = 15360 header bytes at top of file

lskip = 0 header bytes before each line

vaxfc 00% done

vaxfc 05% done

vaxfc 11% done

vaxfc 17% done

vaxfc 23% done

vaxfc 29% done

vaxfc 35% done

vaxfc 41% done

vaxfc 47% done

vaxfc 53% done

vaxfc 58% done

vaxfc 64% done

vaxfc 70% done

vaxfc 76% done

vaxfc 82% done

vaxfc 88% done

vaxfc 94% done

vaxfc all done

Done with vaxfc

... execution terminated!

References

[1] AIRSAR Reference Manual, J.J. vanZyl, editor, 1991

[2] VAX Hardware handbook, Digital Equipment Corporation, 1982.