HP 3000 Manuals

Major Considerations [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation


SPL to HP C/XL Migration Guide

Major Considerations 

MPE V and MPE XL have two areas of incompatibility that may make it
difficult for you to convert SPL programs to HP C/XL:

 *  The representation of floating-point numbers

 *  Data storage alignment

Floating-Point Numbers 

MPE XL floating-point numbers are represented in the industry-standard
IEEE format.  This format is different from the MPE V format in bit
layout, range, and precision.  (Range is governed by the size of the
exponent; precision is governed by the size of the fraction.)

MPE V 32-bit floating-point numbers:

  Bit layout:  1-bit sign, 9-bit exponent, 22-bit fraction
  Nonzero range:  Ý8.63617x10-78  to Ý1.157921x1077  

MPE XL 32-bit floating-point numbers:

  Bit layout:  1-bit sign, 8-bit exponent, 23-bit fraction
  Nonzero range:  Ý1.754944x10-38  to Ý3.4028235x1038  

MPE V 64-bit floating-point numbers:

  Bit layout:  1-bit sign, 9-bit exponent, 54-bit fraction
  Nonzero range:  Ý8.63618555094445x10-78  to Ý1.157920892373162x1077  

MPE XL 64-bit floating-point numbers:

  Bit layout:  1-bit sign, 11-bit exponent, 52-bit fraction
  Nonzero range:  Ý2.2250738585072014x10-308  to Ý1.7976931348623157x10308  

MPE XL 32-bit floating point has greater precision but a smaller range
than MPE V. Thus, it is possible to have a valid MPE V floating-point
number that is not representable in MPE XL floating point.

On the other hand, MPE XL 64-bit floating-point numbers can handle a much
higher range than MPE V 32-bit or 64-bit floating point, but they have
less precision than MPE V 64-bit floating point.

The data storage formats are quite different, corresponding to the bit
representations noted above.  Floating-point data stored on disk must be
converted or replaced if the programs are converted to HP C/XL.

The MPE XL intrinsic HPFPCONVERT may be used to convert floating point
data to and from the various representations.  See the MPE XL Intrinsics 
Reference Manual for details.

Data Storage Alignment 

On MPE V, a data item whose size is two bytes or greater is aligned on a
two-byte boundary.

On MPE XL, a data item is aligned on a boundary not less than the size of
the data item itself, that is, a multiple of 1, 2, 4, or 8 bytes.

Thus, a character followed by a 64-bit floating-point number would
require 10 bytes in MPE V and 16 bytes in MPE XL.

In MPE V, the character would start at byte 0, there would be one unused
byte, and the floating-point number would start at byte 3.  In MPE XL,
the character would start at byte 0, there would be seven unused bytes,
and the floating point number would start at byte 8.

This incompatibility of data storage affects program access to data both
in memory and on disk.



MPE/iX 5.0 Documentation