[mod.computers.vax] Data Conversion

zar@XHMEIA.CALTECH.EDU.UUCP (02/07/87)

Can someone tell me how to convert a real*4 Perkin-Elmer data to VAX
real*4. What I need is how the PE real data is stored (what bits have the
mantissa etc.). This info for the VAX would be handy, although I can just
as easily look the VAX data storage for real numbers myself (I'm lazy :-) ).
Many many thanks and blessings to all who respond...

Zar
ZAR@CITCHEM (Bitnet)
ZAR@XHMEIA.CALTECH.EDU (Arpa)

btb%ncoast.UUCP%case.CSNET@RELAY.CS.NET.UUCP (02/15/87)

In article <870206135928.005@Xhmeia.Caltech.Edu> zar@XHMEIA.CALTECH.EDU writes:
>Can someone tell me how to convert a real*4 Perkin-Elmer data to VAX
>real*4. What I need is how the PE real data is stored (what bits have the
>mantissa etc.). This info for the VAX would be handy, although I can just
>as easily look the VAX data storage for real numbers myself (I'm lazy :-) ).
>Many many thanks and blessings to all who respond...
>
>Zar
>ZAR@CITCHEM (Bitnet)
>ZAR@XHMEIA.CALTECH.EDU (Arpa)

Zar,
	I have just finished struggling with this... we have a PET scanner
that is run on some PE 3205's and a 3210 running OS/32, and we wanted to
do some analysis and archiving of the data on a Vax 11/750 running VMS...

	There are two main problems with this conversion:

		1) PE stores bytes in a Real*4 in a different order
		than on the Vax, 4-3-2-1 vs. 3-4-1-2 respectively,
		where 4 is the msbyte, and the bytes are listed in
		order of increasing storage location... and two

		2) PE uses a different floating point format than the
		Vax... the PE format actually has a wider dynamic
		range than the Vax (roughly 10+/-76 vx. 10+/-38), so
		you have to decide how you will handle that... you can
		also use the /g_float option of the vax fortran compiler,
		and interpret the pe real*4 into a vax g_float real*8,
		but that is sort of a pain...  i tried it both ways, and
		finally ended up going with a conversion into normal
		vax real*4 letting the conversion routine do some checking
		for under/overflow...

concurrent (i.e., pe) wasn't much help with this problem, but they tried...
i ended up having to learn all about floating point formats...
	pe uses an ibm-like format with a 7-bit excess 64 HEX-based
	exponent, whereas
	dec uses an 8-bit excess 128 binary-based exponent

if you want, i could send you the subroutine that i wrote to :

		pe_real4_to_vax_real4(x)

actually it is a fortran function... i think i still have the g_float
version around, too, let me know.


-- 
			Brad Banko
			...!decvax!cwruecmp!ncoast!btb
			Cleveland, Ohio

"The only thing we have to fear on this planet is man."
			-- Carl Jung, 1875-1961