Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Philippe Pouliquen <philippe@alpha.ece.jhu.edu>
Subject: Re: VAX D-Float format
Date: 1997/11/06	[thread overview]
Message-ID: <3461DAA6.41C6@alpha.ece.jhu.edu> (raw)
In-Reply-To: 63q51i$8qa@usenet.pa.dec.com


Steve Lionel wrote:
> |>On 30 Oct 1997 15:55:29 GMT, lionel@mail.dec.com (Steve Lionel) wrote:
> |>>  Type    Exponent bits    Exponent bias    Fraction bits (including hidden)
> |>>  ==========================================================================
> |>>   F           8                128               24
> |>>   D           8                128               56
> |>>   G          11               1024               53
> |>>   H          15              16384              113
        S           8                127               24 (IEEE single
precision)
        T          11               1023               53 (IEEE double
precision)

I've added the IEEE floating point info from the alpha architecture
reference
manual for comparison (the alpha supports both IEEE and VAX formats, but
will
drop the last three mantissa bits when operating on D_floating).

> In VAX floating, the fraction is 0.F, not 1.F as it is in IEEE float.

I believe you meant "...the fraction is 0.1F not 1.F...". Both the VAX
formats
and the IEEE format do not include the redundant most significant
fraction bit
(this is what is meant by "hidden 1").

> --
> Steve Lionel                      mailto:Steve.Lionel@digital.com
> Fortran Development               http://www.digital.com/info/slionel.html
> Digital Equipment Corporation
> 110 Spit Brook Road, ZKO2-3/N30
> Nashua, NH 03062-2698             "Free advice is worth every cent"
> 
> For information on DIGITAL Fortran, see http://www.digital.com/fortran

Here is the generic bit pattern for the VAX and IEEE floats:

Sign  Exponent       Mantissa        IEEE value       VAX value

0     0111...101     000...000       2^-2=0.25        2^-3=0.125
0     0111...110     000...000       2^-1=0.5         2^-2=0.25
0     0111...111     000...000       2^0=1            2^-1=0.5
0     1000...000     000...000       2^1=2            2^0=1
0     1000...001     000...000       2^2=4            2^1=2
0     1000...010     000...000       2^3=8            2^2=4

1     0111...111     000...000       -(2^0)=-1        -(2^-1)=-0.5
1     1000...000     000...000       -(2^1)=-2        -(2^0)=-1

You will note that in every case, F_floating and S_floating differ by a
factor of 2, and G_floating and T_floating also differ by a factor of 2.
A D_floating is just a F_floating with an extra 32 bits of mantissa.

Here are some more examples with non-zero mantissa:

0     0111...111     100...000       (1.5)*(2^0)=1.5  (1.5)*(2^-1)=0.75
0     1000...000     100...000       (1.5)*(2^1)=3    (1.5)*(2^0)=1.5

So you have some D_floating data, and you want to process it with a
modern
IEEE compliant machine? (and you don't want to buy an alpha running
VMS?)
Here's what you would want to do with the bits:

    D_floating bits:   F_floating bits:   G_floating bits:   H_floating
bits:

sign: D63                F31=D63            G63=D63            H127=D63

 e    D62                F30=D62            G62=D62            H126=D62
 x    D61                F29=D61            G61=D61            H125=D61
 p                                          G60=D61            H124=D61
 o                                          G59=D61            H123=D61
 n                                          G58=D61            H122=D61
 e                                                             H121=D61
 n                                                             H120=D61
 t                                                             H119=D61
                                                               H118=D61
      D60                F28=D60            G57=D60            H117=D60
      D59                F27=D59            G56=D59            H116=D59
      D58                F26=D58            G55=D58            H115=D58
      D57                F25=D57            G54=D57            H114=D57
      D56                F24=D56            G53=D56            H113=D56
      D55                F23=D55            G52=D55            H112=D55

 m    D54                F22=D54            G51=D54            H111=D54
 a    D53                F21=D53            G50=D53            H110=D53
 n    D52                F20=D52            G49=D52            H109=D52
 t     .                  .   .              .   .              .   .
 i     .                  .   .              .   .              .   .
 s     .                  .   .              .   .              .   .
 s    D34                F2 =D34            G31=D34            H91 =D34
 a    D33                F1 =D33            G30=D33            H90 =D33
      D32                F0 =D32            G29=D32            H89 =D32
      D31                                   G28=D31            H88 =D31
      D30                                   G27=D30            H87 =D30
      D29                                   G26=D29            H86 =D29
       .                                     .   .              .    .
       .                                     .   .              .    .
       .                                     .   .              .    .
      D5                                    G2 =D5             H62 =D5
      D4                                    G1 =D4             H61 =D4
      D3                                    G0 =D3             H60 =D3
      D2                                                       H59 =D2
      D1                                                       H58 =D1
      D0                                                       H57 =D0
                                                               H56 = 0
                                                               H55 = 0
                                                               H54 = 0
                                                                .    .
                                                               H2  = 0
                                                               H1  = 0
                                                               H0  = 0

Once you have the correct VAX format, convert to the same size IEEE
format
by dividing by 2.


Hope this helps and sets this issue to rest. (I also hope I didn't make
a
typo :-)

Philippe Pouliquen
Electrical and Computer Engineering
Johns Hopkins University
Baltimore, USA



  reply	other threads:[~1997-11-06  5:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-29  5:00 VAX D-Float format Chieh Cheng
1997-10-30  5:00 ` John Laird
1997-10-30  5:00 ` Gregg E Economou
1997-10-31  5:00   ` Chieh Cheng
     [not found]     ` <199711051454.JAA02820@dbit.dbit.com>
1997-11-05  5:00       ` WTB: Iomega Zip Drive Jerome Fine
1997-11-05  5:00     ` Jerome Fine
1997-10-30  5:00 ` VAX D-Float format Steve Lionel
1997-10-31  5:00   ` Dik T. Winter
1997-10-31  5:00     ` John Wilson
1997-11-03  5:00       ` Dik T. Winter
1997-11-03  5:00   ` Chieh Cheng
1997-11-05  5:00     ` Steve Lionel
1997-11-06  5:00       ` Philippe Pouliquen [this message]
1997-11-10  5:00         ` John Laird
1997-10-30  5:00 ` Steve Atkins
1997-10-31  5:00   ` Pedasmith
1997-10-30  5:00 ` Hoff Hoffman
1997-11-05  5:00 ` John Foust
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