Article View: comp.sys.sun
Article #1689Re: VAX real number conversion programs
From: Maj Brian Boyter
Date: Fri, 29 Sep 1989 00:40
Date: Fri, 29 Sep 1989 00:40
52 lines
1871 bytes
1871 bytes
In article <1763@brazos.Rice.edu>, dinah@nicolle.bcm.tmc.edu (Dinah Anderson) writes:
> Does anyone know where there is a program to convert VAX real*2 and real*4
> data files into a format the Sun can read? Thanks.
I got this code orginially from bsabata@cs.utexas.edu....
I have modified it somewhat....
/* routine that converts the vax floating point numbers to
RT/IEEE floating point format */
float
vfloat(vax)
float vax;
{
union {
char bytes[4];
float flt;
struct {
unsigned int sign:1;
unsigned int exp:8;
unsigned int mant:23;
} f;
} ieee;
union {
float flt;
char bytes[4];
} vaxx;
/* swap bytes */
vaxx.flt = vax;
ieee.bytes[0] = vaxx.bytes[1];
ieee.bytes[1] = vaxx.bytes[0];
ieee.bytes[2] = vaxx.bytes[3];
ieee.bytes[3] = vaxx.bytes[2];
/* adjust exponent */
if( ieee.f.exp < 2)
ieee.flt = 0.0; /* underflows */
else ieee.f.exp -= 2;
return(ieee.flt);
}
Maj. Brian A Boyter
US Army Foreign Science & Technology Center
Charlottesville, Va 22901 __
off: (804)980-7362 ( )
home: 973-9440 { }
boyter%bimbo.uucp@virginia.acc.virginia.edu ( )
||
Nuke'm 'till they glow ||
...Then shoot'm in the dark ________< >_______
Technical Details
Message-ID:
<1833@brazos.Rice.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!wuarchive!ukma!husc6!rice!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!wuarchive!ukma!husc6!rice!sun-spots-request From: bimbo!boyter@uunet.uu.net (Maj Brian Boyter) Newsgroups: comp.sys.sun Subject: Re: VAX real number conversion programs Keywords: Source Message-ID: <1833@brazos.Rice.edu> Date: 29 Sep 89 00:40:43 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 52 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 147, message 3 of 8