comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: VAX floats to IEEE (source code avail.)

VAX floats to IEEE (source code avail.)
type: item
description: There has apparently been some discussion in this newsgroup about code to convert from VAX floats (REAL*4) to IEE format on various platforms. Unfortunately all of the items were expired when I got around to reading them so please forgive me if this is redundant. I have written a routine in C that does the job well on a number of platforms. My routine (vaxf2ieee.c appended below) may not be the most efficient in the world, but I think it is accurate. I spent quite a bit of time handling the very small numbers that give trouble when converting from the VAX number set to the IEEE. This is the domain of unnormalized fractions in the IEEE world which has no analogy in the older VAX world. If you don't care about these admittedly improbable numbers then your code can be a lot simpler. Routine vaxf2ieee.c runs well on MAC, PC, HP, and SUN. I also wrote two wrapper routines that allow it to be hooked into IDL using the call_external mechanism. Routine vaxf2ieee_w.c is a wrapper in C that just converts the calling parameters from the damn argc, argv that call_external uses, to the more intuitive interface of the workhorse routine. Routine vaxf2ieee.pro is a wrapper routine written in IDL that calls the C wrapper routine. Why two wrapper routines? Because I wanted a very general routine in C to do the job that used intuitively obvious variables, not the totally obscure argc, argv interface demanded by call_external. While my C routines ought to port easily to almost any machine, my IDL wrapper is written specifically for use under HPUX and is hardwired for my particular use. Conversion to other machines and users ought not to be too difficult I hope. If anyone ports this code to the PC or MAC under IDL, I would appreciate receiving a copy of the appropriate wrapper code. The routines are appended below. ***************** This is the IDL wrapper written for HPUX *************** ; vaxf2ieee.pro Convert VAX floating point format to IEEE format. ; blg 1/6/93 ; 4/10/94 Changed to…
creator: gotwols
date: 1994-11-01T22:57:00-00:00