From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 115914,eb58654c5683eea0 X-Google-Attributes: gid115914,public X-Google-Thread: 1164f8,eb58654c5683eea0 X-Google-Attributes: gid1164f8,public X-Google-Thread: 10cebf,eb58654c5683eea0 X-Google-Attributes: gid10cebf,public From: hoffman@xdelta.enet.dec.nospam (Hoff Hoffman) Subject: Re: VAX D-Float format Date: 1997/10/30 Message-ID: <63b0b9$fs4@usenet.pa.dec.com>#1/1 X-Deja-AN: 286035318 Distribution: world References: <34575f82.182344367@serve.installshield.com> Organization: Digital Equipment Corp Reply-To: hoffman@xdelta.zko.dec.nospam Newsgroups: comp.sys.dec,comp.sys.dec.micro,comp.arch.arithmetic In article <34575f82.182344367@serve.installshield.com>, chiehcheng@geocities.com (Chieh Cheng) writes: :I am trying to decode and decipher Intergraph Microstation's Design :file format. It uses the VAX D-Float format. Although it is also 64 :bit long, it is somewhat different from the IEEE double float format. Well, the VAX architecture predated the IEEE floating point standards by a few years. :-) :The format is as follows: : :bit 15: sign :bit 14 - 7: Exponent :bit 6 - 0: Exponent : :bit 16 to 63 is the fraction. I assume it is one fraction, however, :the diagram in the book divided it into three equal parts. Like the :exponent shown above. Your book appears somewhat confused, as D_Float bits 6 through 0 are part of the fraction, not the exponent. Here are the VAX F_Floating, D_Floating, G_Floating, and H_Floating floating-point formats: 31 16 15 14 7 6 0 +-----------+--+-----+----------+ fraction normalized; F | frac-1 |S | exp | frac-2 | exponent bias 128. +-----------+-------------------+ 31 16 15 14 7 6 0 +-----------+--+-----+----------+ fraction normalized; D | frac-3 |S | exp | frac-4 | exponent bias 128. +-----------+-------------------+ | frac-1 | frac-2 | +-----------+-------------------+ 31 16 15 14 4 3 0 +-----------+--+-------+--------+ fraction normalized; G | frac-3 |S | exp | frac-4 | exponent bias 1024. +-----------+-------------------+ | frac-1 | frac-2 | +-----------+-------------------+ 31 16 15 14 0 +-----------+--+----------------+ fraction normalized; H | frac-7 |S | exp | exponent bias 16384 +-----------+-------------------+ | frac-5 | frac-6 | +-----------+-------------------+ | frac-3 | frac-4 | +-----------+-------------------+ | frac-1 | frac-2 | +-----------+-------------------+ With the least significant to the most significant bits of the fraction being listed from frac-1 to frac-n. S is the sign bit. :Can someone help me with this format? How can I convert this binary :data to a double float? A double float using what format? On all recent OpenVMS releases, there are library routines to convert this stuff for you -- without access to these routines, we need to know what floating point format you want to convert this format to... To convert it to j-random format, you need to move the exponent and the fraction into the appropriate fields. And DIGITAL VAX and Alpha systems, as well as systems based on the Intel IA32 architecture are little-endian, other platforms may use a big-endian scheme. :Any help is greatly appreciated. Thanks. Take a look at the OpenVMS Frequently Asked Questions (FAQ), and see if the Floating Point information included there helps any. (In addition to what is here.) ---------------------------------------------------------------------------- Hoff (Stephen) Hoffman OpenVMS Engineering h*ffman@xdelta.enet.dec.c*m headers and addresses munged to avoid automated spammers: junk-e-mail