Reading IEEE floating point on DEC OpenVMS [message #4232] |
Thu, 11 May 1995 00:00  |
system
Messages: 3 Registered: June 1992
|
Junior Member |
|
|
Is there a way in PV-WAVE or IDL for DEC OpenVMS to read an unformatted
external data file which contains IEEE 4-byte and 8-byte floating point
numbers?
I assume this involves conversion from IEEE representation to the
default internal VAX or AXP representation (F_floating for single
precision and D_floating (VAX) or G_floating (AXP) for double precision).
------------------------------------------------------------ ------------
Ulrich Schmitt | Phone: +41 1 632 4440
Laboratorium fur Phys. Chemie | Fax: +41 1 632 1021
ETH Zurich (Zentrum) | E-Mail: schmitt@ir.phys.chem.ethz.ch
CH-8092 Zurich, Switzerland | ulsi@debye.vmsmail.ethz.ch
------------------------------------------------------------ ------------
|
|
|
Re: Reading IEEE floating point on DEC OpenVMS [message #4269 is a reply to message #4232] |
Thu, 18 May 1995 00:00  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
system@ir.phys.chem.ethz.ch (Ulrich Schmitt, Phys. Chem., ETH Zurich) writes:
> Is there a way in PV-WAVE or IDL for DEC OpenVMS to read an unformatted
> external data file which contains IEEE 4-byte and 8-byte floating point
> numbers?
> I assume this involves conversion from IEEE representation to the
> default internal VAX or AXP representation (F_floating for single
> precision and D_floating (VAX) or G_floating (AXP) for double precision).
> ------------------------------------------------------------ ------------
> Ulrich Schmitt | Phone: +41 1 632 4440
> Laboratorium fur Phys. Chemie | Fax: +41 1 632 1021
> ETH Zurich (Zentrum) | E-Mail: schmitt@ir.phys.chem.ethz.ch
> CH-8092 Zurich, Switzerland | ulsi@debye.vmsmail.ethz.ch
> ------------------------------------------------------------ ------------
Look at the routines IEEE_TO_HOST and HOST_TO_IEEE available from the Astronomy
User's Library at URL
ftp://idlastro.gsfc.nasa.gov/pro/misc/
These routines use BYTE_ORDER routine with the appropriate keywords to do the
conversion. Note that this assumes that the IEEE values have the standard
byteorder. If you're trying to read values that were written on a machine that
uses a reversed byte order, such as Ultrix or OSF, then you may need to reverse
the bytes first before applying IEEE_TO_HOST.
The best thing to do, if you can manage it, is to use HOST_TO_IEEE on the data
before writing it, and then you can use IEEE_TO_HOST on any other machine to
read it. That way, you never have to worry about differences in byte-ordering
or data representation between machines.
IDL only supports F_float and D_float representations. In OpenVMS, it uses the
same data representations on both VAX and AXP platforms.
Bill Thompson
|
|
|