VAX SUN binary conversions

George Travan munnari!sirius.ua.oz.au!gtravan at uunet.uu.net
Thu Jul 6 13:50:37 AEST 1989


I have a need to convert vax floating point numbers to sun ieee format.
problem is the routine :

union ie3float { char c[4]; int exp; float f; };
void vf2ie3f(u,n) register union ie3float *u; register int n; {
/* VAX float to IEEE float */
register char tmp;
register int i;
for(i=0; i<n; u++,i++) {
   if (! u->exp) continue;
   tmp=u->c[0]; u->c[0]=u->c[1]-1; u->c[1]=tmp;
   tmp=u->c[2]; u->c[2]=u->c[3];   u->c[3]=tmp;
}
}

            when passed a pointer to data such as 0x80400000 which
corresponds to vax 0x00004080 = 1.0 doesnt give me the right answer on my
SUN 3/60. i get -1369117816400609700000000000000000000000.000000  (??)

 can you see anything here that i cant?

  /GeO		ACSnet:  gtravan at sirius.ua.oz



More information about the Comp.sys.sun mailing list