next up previous contents index
Next: Exchange File Format Up: Format specifications Previous: Exchange mode

Exchange Data format

The unit of information is a word of 32 bits, (double-precision numbers require two words each). A word may contain:

 - positive integer:  true binary
 - negative integer:  two's complement of the absolute value
 - floating point:    IEEE standard as shown below
 - Hollerith:         4 character 8-bit ASCII, stored left to right
 - bit pattern:       32 bits of zero or one (no conversion)

The following reduction may occur when transforming to the exchange representation on machines with a word-size larger than 32 bits:

 - integer:     'bad conversion' if more than 31 significant bits
 - floating:    reduced precision, but correctly rounded
 - Hollerith:   only the first 4 characters are taken
                 (trailing characters should be blank anyway)
 - bit pattern: only the right-hand 32 bits are taken

The following expansions may occur for the inverse transformation:

 - Hollerith:   blank fill
 - bit pattern: zero-fill of the leading bits

The IEEE representation of single and double precision floating-point numbers is:

Single precision:  1  bit  32       the sign-bit 's'
                   8  bits 31 - 24  the characteristic 'c'
                  23  bits 23 -  1  the mantissa 'm'

Double precision:  1  bit  64       the sign-bit 's'
                  11  bits 63 - 53  the characteristic 'c'
                  52  bits 52 -  1  the mantissa 'm'

A normal floating point number is represented by 3 fields on one or two 32-bit words:

'm' is the fractional part of the mantissa M; the binary point is assumed to be immediately to the left of the most significant bit of m, preceded by an implied 1 (hidden bit), for example:

         m             M mantissa       decimal value

         0000...0      1.0000...0       1.
         1000...0      1.1000...0       1.5
         1100...0      1.1100...0       1.75

'c' is the characteristic, being the binary exponent with a bias of 127 or 1023 added, for example:

         c             exponent        c              exp

         011...101     -2              100...000      1
         011...110     -1              100...001      2
         011...111      0              100...011      3

A normal floating-point number does not have a c of all ones or all zeros, such characteristics are used to represent Exceptions.

's' is the sign-bit, the number is negative if this bit is on. The representation of floating-point numbers is of the sign/magnitude form, ie. only the sign-bit is complemented to change the sign of the number.

The Exceptions are:

   c=0, m=0            floating-point zero
   c=0, m= not 0       'de-normalized number',
                       value:   +/-  0.m  *  2**(-126 or -1022)
   c=all 1, m=0        signed infinity  (c=255 or 2047)
   c=all 1, m= not 0   'not a number (NaN)'


Janne Saarela
Mon May 15 08:34:47 METDST 1995