dinah@nicolle.bcm.tmc.edu (Dinah Anderson) (09/28/89)
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. Dinah Anderson internet: dinah@bcm.tmc.edu Baylor College of Medicine uucp: {rutgers,mailrus}!bcm!dinah
boyter@uunet.uu.net (Maj Brian Boyter) (09/29/89)
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 ________< >_______