From: pack@acdpyr.ucar.edu (Dan Packman)
Subject: Re: difference between vax floating point representation and IEEE
Date: 22 Jul 88 22:37:55 GMT [thread overview]
Message-ID: <471@ncar.ucar.edu> (raw)
In-Reply-To: 2256@hubcap.UUCP
In article <2256@hubcap.UUCP> ghosh@hubcap.UUCP (Amitava Ghosh) writes:
>does anyone know what the difference is between the IEEE floating
>point representation and the way the VAX stores numbers. If so
>how does one convert from one format to the other...
The following program converts from vax f format to IEEE (UNIX point of view)
--------cut here-------------
subroutine vax2lcl(n,iarray)
dimension iarray(n)
character*1 conv(4),ccc
integer iconv
equivalence (iconv,conv)
c Convert from vax floating point f format to pyramid IEEE single
do 10 i=1,n
iconv=iarray(i)
if (iconv.ne.0) then
ccc=conv(1)
iii=ichar(conv(2))-1
if (iii.lt.0)then
write(0,100)iconv
100 format(' vax2lcl: overflow int in =',i10)
call exit(1)
endif
conv(1)=char(iii)
conv(2)=ccc
ccc=conv(3)
conv(3)=conv(4)
conv(4)=ccc
iarray(i)=iconv
endif
10 continue
return
end
--------cut here-------------
The following converts an array of IEEE single floats to vax floats
It is written to work on a VAX/VMS machine
--------cut here-------------
subroutine pyr2lcl(n,iarray)
dimension iarray(n)
byte conv(4),ccc
integer iconv
equivalence (iconv,conv)
c Convert from pyramid IEEE single to vax floating point f format
do 10 i=1,n
iconv=iarray(i)
if (iconv.ne.0) then
ccc=conv(2)
iii=conv(1)+1
if (iii.gt.255)then
write(0,100)iconv
100 format(' pyr2lcl: overflow int in =',i10)
call exit(1)
endif
conv(2)=iii
conv(1)=ccc
ccc=conv(3)
conv(3)=conv(4)
conv(4)=ccc
iarray(i)=iconv
endif
10 continue
return
end
prev parent reply other threads:[~1988-07-22 22:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1988-07-21 18:39 difference between vax floating point representation and IEEE Amitava Ghosh
1988-07-21 22:08 ` Greg Woods
1988-07-22 22:37 ` Dan Packman [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox